mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 15:54:05 +08:00
f3aab19829
This commit promotes all post_deploy migrations which existed in Discourse v2.7.13 (timestamp <= 20210328233843) This reduces the likelihood of issues relating to migration run order Also fixes a couple of typos in `script/promote_migrations`
15 lines
664 B
Ruby
15 lines
664 B
Ruby
# frozen_string_literal: true
|
|
class FixTopicTimerDurationMinutes < ActiveRecord::Migration[6.0]
|
|
def up
|
|
DB.exec("DELETE FROM topic_timers WHERE status_type = 7 AND duration > 20 * 365")
|
|
DB.exec("DELETE FROM topic_timers WHERE status_type != 7 AND duration > 20 * 365 * 24")
|
|
|
|
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
|