FIX: Set default for existing records. (#1073)

We'll later copy the correct value from content_range. 1 should be the min highest post number a topic has.
This commit is contained in:
Roman Rizzi 2025-01-16 10:38:53 -03:00 committed by GitHub
parent 46fcdb6ba5
commit 4784e7fe43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -64,7 +64,7 @@ end
# updated_at :datetime not null
# summary_type :integer default("complete"), not null
# origin :integer
# highest_target_number :integer not null
# highest_target_number :integer default(1), not null
#
# Indexes
#

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
class AddHighestTargetNumberToAiSummary < ActiveRecord::Migration[7.2]
def up
add_column :ai_summaries, :highest_target_number, :integer, null: false
add_column :ai_summaries, :highest_target_number, :integer, null: false, default: 1
execute <<~SQL
UPDATE ai_summaries SET highest_target_number = GREATEST(UPPER(content_range) - 1, 1)