Skip to content

Commit

Permalink
FIX: Set default for existing records.
Browse files Browse the repository at this point in the history
We'll later copy the correct value from content_range. 1 should be the min highest post number a topic has.
  • Loading branch information
romanrizzi committed Jan 16, 2025
1 parent 46fcdb6 commit f231b3a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/ai_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def outdated
# 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
#
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit f231b3a

Please sign in to comment.