2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

DEV: Promote historic post_deploy migrations (#16288)

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`
This commit is contained in:
David Taylor 2022-03-25 15:48:20 +00:00 committed by GitHub
parent 9ce6280f51
commit f3aab19829
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 2 additions and 1 deletions

View file

@ -1,14 +0,0 @@
# 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