Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 8630bc1

Browse files
authored
DEV: Set a min and max for translations backfill (#1508)
Since we use the value for days.ago and are seeing PG::DatetimeFieldOverflow: ERROR: timestamp out of range: "5473790-07-13 08:43:28.497823 BC, set limits to the site setting.
1 parent ad6a8cb commit 8630bc1

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

config/settings.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,8 @@ discourse_ai:
527527
area: "ai-features/translation"
528528
ai_translation_backfill_max_age_days:
529529
default: 5
530+
min: 0
531+
max: 20000
530532
client: false
531533
area: "ai-features/translation"
532534
ai_translation_verbose_logs:
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# frozen_string_literal: true
2+
class SetTranslationBackfillMaxAge < ActiveRecord::Migration[7.2]
3+
def up
4+
execute <<~SQL
5+
UPDATE site_settings
6+
SET value = '20000'
7+
WHERE name = 'ai_translation_backfill_max_age_days'
8+
AND value::integer > 20000;
9+
SQL
10+
11+
execute <<~SQL
12+
UPDATE site_settings
13+
SET value = '0'
14+
WHERE name = 'ai_translation_backfill_max_age_days'
15+
AND value::integer < 0;
16+
SQL
17+
end
18+
19+
def down
20+
raise ActiveRecord::IrreversibleMigration
21+
end
22+
end

0 commit comments

Comments
 (0)