mirror of
https://github.com/discourse/discourse.git
synced 2025-04-14 20:12:56 +08:00
FIX: Set null high_priority columns to false in high priority notification migration (#9335)
Some DBs failed on this migration, possibly due to new records being added, with the error ActiveRecord::NotNullViolation: PG::NotNullViolation: ERROR: column "high_priority" contains null values Luckily, the migration is retryable as is.
This commit is contained in:
parent
cade4957ae
commit
393215266f
@ -22,6 +22,10 @@ class AddHighPriorityColumnToNotifications < ActiveRecord::Migration[6.0]
|
||||
ALTER TABLE notifications ALTER COLUMN high_priority SET DEFAULT FALSE;
|
||||
SQL
|
||||
|
||||
execute <<~SQL
|
||||
UPDATE notifications SET high_priority = FALSE WHERE high_priority IS NULL;
|
||||
SQL
|
||||
|
||||
execute <<~SQL
|
||||
ALTER TABLE notifications ALTER COLUMN high_priority SET NOT NULL;
|
||||
SQL
|
||||
|
Loading…
x
Reference in New Issue
Block a user