FIX: Topic timer duration_minutes was not backfilled correctly (#12004)
Because of a where clause of duration_minutes != duration, where
duration_minutes was NULL, the previous migration to fill the new
duration_minutes column failed. This corrects the failed migration
by just running the update where duration_minutes is NULL and duration
IS NOT NULL.
Previous commit is 4af77f1
This commit is contained in:
parent
b021d0dbe1
commit
18da1d5b07
|
@ -0,0 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
class FixTopicTimerDurationMinutes < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
DB.exec("UPDATE topic_timers SET duration_minutes = (duration * 60 * 24) WHERE duration_minutes IS NULL AND status_type = 7 AND duration IS NOT NULL")
|
||||
DB.exec("UPDATE topic_timers SET duration_minutes = (duration * 60) WHERE duration_minutes IS NULL AND status_type != 7 AND duration IS NOT NULL")
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue