mirror of
https://github.com/discourse/discourse.git
synced 2026-08-10 04:58:31 -05:00
DEV: Partially move watched_precedence_over_muted migration to post-migration phase (#35755)
The change_column_null and change_column_default operations for the watched_precedence_over_muted column have been moved from the pre-migration script to the post-migration script. This adjustment ensures that the column is only modified after all data transformations are complete, reducing the risk of data integrity issues during the migration process. We have already seen this once in production, where a later failed migration left the column in a bad state.
This commit is contained in:
@@ -25,9 +25,6 @@ class ConvertWatchedPrecedenceOverMutedToDefaultPref < ActiveRecord::Migration[8
|
||||
SET watched_precedence_over_muted = :preference_value
|
||||
WHERE watched_precedence_over_muted IS NULL;
|
||||
SQL
|
||||
|
||||
change_column_default :user_options, :watched_precedence_over_muted, from: nil, to: false
|
||||
change_column_null :user_options, :watched_precedence_over_muted, false
|
||||
end
|
||||
|
||||
def down
|
||||
|
||||
@@ -4,6 +4,9 @@ class DeleteOldWatchedPrecedenceSetting < ActiveRecord::Migration[8.0]
|
||||
DB.exec(<<~SQL)
|
||||
DELETE FROM site_settings WHERE name = 'watched_precedence_over_muted';
|
||||
SQL
|
||||
|
||||
change_column_default :user_options, :watched_precedence_over_muted, from: nil, to: false
|
||||
change_column_null :user_options, :watched_precedence_over_muted, false
|
||||
end
|
||||
|
||||
def down
|
||||
|
||||
Reference in New Issue
Block a user