mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
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
11 lines
485 B
Ruby
11 lines
485 B
Ruby
# 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
|