A platform for community discussion. Free, open, simple.
DEV: Promote old post-deploy migrations to pre-deploy migrations (#13477)
David Taylore76c583b91f7
diff --git a/db/post_migrate/20180917024729_remove_superfluous_columns.rb b/db/migrate/20180917024729_remove_superfluous_columns.rbsimilarity index 100%rename from db/post_migrate/20180917024729_remove_superfluous_columns.rbrename to db/migrate/20180917024729_remove_superfluous_columns.rbdiff --git a/db/post_migrate/20180917034056_remove_superfluous_tables.rb b/db/migrate/20180917034056_remove_superfluous_tables.rbsimilarity index 100%rename from db/post_migrate/20180917034056_remove_superfluous_tables.rbrename to db/migrate/20180917034056_remove_superfluous_tables.rbdiff --git a/db/post_migrate/20181012123001_drop_group_locked_trust_level_from_user.rb b/db/migrate/20181012123001_drop_group_locked_trust_level_from_user.rbsimilarity index 100%rename from db/post_migrate/20181012123001_drop_group_locked_trust_level_from_user.rbrename to db/migrate/20181012123001_drop_group_locked_trust_level_from_user.rbdiff --git a/db/post_migrate/20181112013117_migrate_url_site_settings.rb b/db/migrate/20181112013117_migrate_url_site_settings.rbsimilarity index 100%rename from db/post_migrate/20181112013117_migrate_url_site_settings.rbrename to db/migrate/20181112013117_migrate_url_site_settings.rbdiff --git a/db/post_migrate/20190103065652_remove_uploaded_meta_id_from_category.rb b/db/migrate/20190103065652_remove_uploaded_meta_id_from_category.rbsimilarity index 100%rename from db/post_migrate/20190103065652_remove_uploaded_meta_id_from_category.rbrename to db/migrate/20190103065652_remove_uploaded_meta_id_from_category.rbdiff --git a/db/post_migrate/20190121203023_drop_queued_post_id_from_user_actions.rb b/db/migrate/20190121203023_drop_queued_post_id_from_user_actions.rbsimilarity index 100%rename from db/post_migrate/20190121203023_drop_queued_post_id_from_user_actions.rbrename to db/migrate/20190121203023_drop_queued_post_id_from_user_actions.rbdiff --git a/db/post_migrate/20190123171817_drop_queued_posts.rb b/db/migrate/20190123171817_drop_queued_posts.rbsimilarity index 100%rename from db/post_migrate/20190123171817_drop_queued_posts.rbrename to db/migrate/20190123171817_drop_queued_posts.rbdiff --git a/db/post_migrate/20190205104116_drop_unused_auth_tables.rb b/db/migrate/20190205104116_drop_unused_auth_tables.rbsimilarity index 100%rename from db/post_migrate/20190205104116_drop_unused_auth_tables.rbrename to db/migrate/20190205104116_drop_unused_auth_tables.rbdiff --git a/db/post_migrate/20190208144706_drop_unused_auth_tables_again.rb b/db/migrate/20190208144706_drop_unused_auth_tables_again.rbsimilarity index 100%rename from db/post_migrate/20190208144706_drop_unused_auth_tables_again.rbrename to db/migrate/20190208144706_drop_unused_auth_tables_again.rbdiff --git a/db/post_migrate/20190312194528_drop_email_user_options_columns.rb b/db/migrate/20190312194528_drop_email_user_options_columns.rbsimilarity index 100%rename from db/post_migrate/20190312194528_drop_email_user_options_columns.rbrename to db/migrate/20190312194528_drop_email_user_options_columns.rbdiff --git a/db/post_migrate/20190508141824_drop_claimed_by_id.rb b/db/migrate/20190508141824_drop_claimed_by_id.rbsimilarity index 100%rename from db/post_migrate/20190508141824_drop_claimed_by_id.rbrename to db/migrate/20190508141824_drop_claimed_by_id.rbdiff --git a/db/post_migrate/20190716124050_remove_via_email_from_invite.rb b/db/migrate/20190716124050_remove_via_email_from_invite.rbsimilarity index 100%rename from db/post_migrate/20190716124050_remove_via_email_from_invite.rbrename to db/migrate/20190716124050_remove_via_email_from_invite.rbdiff --git a/db/post_migrate/20191107032231_change_notification_level.rb b/db/migrate/20191107032231_change_notification_level.rbsimilarity index 100%rename from db/post_migrate/20191107032231_change_notification_level.rbrename to db/migrate/20191107032231_change_notification_level.rbdiff --git a/db/post_migrate/20191107190330_remove_suppress_from_latest_from_category.rb b/db/migrate/20191107190330_remove_suppress_from_latest_from_category.rbsimilarity index 100%rename from db/post_migrate/20191107190330_remove_suppress_from_latest_from_category.rbrename to db/migrate/20191107190330_remove_suppress_from_latest_from_category.rbdiff --git a/db/post_migrate/20191129144706_drop_unused_google_instagram_auth_tables.rb b/db/migrate/20191129144706_drop_unused_google_instagram_auth_tables.rbsimilarity index 100%rename from db/post_migrate/20191129144706_drop_unused_google_instagram_auth_tables.rbrename to db/migrate/20191129144706_drop_unused_google_instagram_auth_tables.rbdiff --git a/db/post_migrate/20191219112000_remove_key_from_api_keys.rb b/db/migrate/20191219112000_remove_key_from_api_keys.rbsimilarity index 100%rename from db/post_migrate/20191219112000_remove_key_from_api_keys.rbrename to db/migrate/20191219112000_remove_key_from_api_keys.rbdiff --git a/db/post_migrate/20200117174646_make_post_reply_id_column_read_only.rb b/db/migrate/20200117174646_make_post_reply_id_column_read_only.rbsimilarity index 100%rename from db/post_migrate/20200117174646_make_post_reply_id_column_read_only.rbrename to db/migrate/20200117174646_make_post_reply_id_column_read_only.rbdiff --git a/db/post_migrate/20200120131338_drop_unused_columns.rb b/db/migrate/20200120131338_drop_unused_columns.rbsimilarity index 100%rename from db/post_migrate/20200120131338_drop_unused_columns.rbrename to db/migrate/20200120131338_drop_unused_columns.rbdiff --git a/db/post_migrate/20200330233427_drop_old_unread_pm_notification_indices.rb b/db/migrate/20200330233427_drop_old_unread_pm_notification_indices.rbsimilarity index 100%rename from db/post_migrate/20200330233427_drop_old_unread_pm_notification_indices.rbrename to db/migrate/20200330233427_drop_old_unread_pm_notification_indices.rbdiff --git a/db/post_migrate/20200408121312_remove_key_from_user_api_key.rb b/db/migrate/20200408121312_remove_key_from_user_api_key.rbsimilarity index 100%rename from db/post_migrate/20200408121312_remove_key_from_user_api_key.rbrename to db/migrate/20200408121312_remove_key_from_user_api_key.rbdiff --git a/db/post_migrate/20200415140830_drop_automatic_membership_retroactive_from_group.rb b/db/migrate/20200415140830_drop_automatic_membership_retroactive_from_group.rbsimilarity index 100%rename from db/post_migrate/20200415140830_drop_automatic_membership_retroactive_from_group.rbrename to db/migrate/20200415140830_drop_automatic_membership_retroactive_from_group.rbdiff --git a/db/post_migrate/20200424032633_remove_canonical_email_from_user_emails.rb b/db/migrate/20200424032633_remove_canonical_email_from_user_emails.rbsimilarity index 100%rename from db/post_migrate/20200424032633_remove_canonical_email_from_user_emails.rbrename to db/migrate/20200424032633_remove_canonical_email_from_user_emails.rbdiff --git a/db/post_migrate/20200430010528_remove_avg_time_from_topics_posts.rb b/db/migrate/20200430010528_remove_avg_time_from_topics_posts.rbsimilarity index 100%rename from db/post_migrate/20200430010528_remove_avg_time_from_topics_posts.rbrename to db/migrate/20200430010528_remove_avg_time_from_topics_posts.rbdiff --git a/db/post_migrate/20200508141209_allow_null_old_email_on_email_change_requests.rb b/db/migrate/20200508141209_allow_null_old_email_on_email_change_requests.rbsimilarity index 100%rename from db/post_migrate/20200508141209_allow_null_old_email_on_email_change_requests.rbrename to db/migrate/20200508141209_allow_null_old_email_on_email_change_requests.rbdiff --git a/db/post_migrate/20200513185052_drop_topic_reply_count.rb b/db/migrate/20200513185052_drop_topic_reply_count.rbsimilarity index 100%rename from db/post_migrate/20200513185052_drop_topic_reply_count.rbrename to db/migrate/20200513185052_drop_topic_reply_count.rbdiff --git a/db/post_migrate/20200520001619_remove_fks_from_bookmarks.rb b/db/migrate/20200520001619_remove_fks_from_bookmarks.rbsimilarity index 100%rename from db/post_migrate/20200520001619_remove_fks_from_bookmarks.rbrename to db/migrate/20200520001619_remove_fks_from_bookmarks.rbdiff --git a/db/post_migrate/20200522004855_remove_access_control_post_fk.rb b/db/migrate/20200522004855_remove_access_control_post_fk.rbsimilarity index 100%rename from db/post_migrate/20200522004855_remove_access_control_post_fk.rbrename to db/migrate/20200522004855_remove_access_control_post_fk.rbdiff --git a/db/post_migrate/20200601111500_remove_image_url_from_post_and_topic.rb b/db/migrate/20200601111500_remove_image_url_from_post_and_topic.rbsimilarity index 100%rename from db/post_migrate/20200601111500_remove_image_url_from_post_and_topic.rbrename to db/migrate/20200601111500_remove_image_url_from_post_and_topic.rbdiff --git a/db/post_migrate/20200610150900_correct_posts_schema.rb b/db/migrate/20200610150900_correct_posts_schema.rbsimilarity index 100%rename from db/post_migrate/20200610150900_correct_posts_schema.rbrename to db/migrate/20200610150900_correct_posts_schema.rbdiff --git a/lib/migration/safe_migrate.rb b/lib/migration/safe_migrate.rbindex 0b65ee0a261..3b4a386dfaf 100644--- a/lib/migration/safe_migrate.rb+++ b/lib/migration/safe_migrate.rb@@ -6,7 +6,6 @@ class Discourse::InvalidMigration < StandardError; endclass Migration::SafeMigratemodule SafeMigration- UNSAFE_VERSION = 20180321015220@@enable_safe = truedef self.enable_safe!@@ -19,7 +18,7 @@ class Migration::SafeMigratedef migrate(direction)if direction == :up &&- version && version > UNSAFE_VERSION &&+ version && version > Migration::SafeMigrate.earliest_post_deploy_version &&@@enable_safe != false &&!is_post_deploy_migration?@@ -153,4 +152,12 @@ class Migration::SafeMigrateraise Discourse::InvalidMigration, "Attempt was made to rename or delete column"endend++ def self.earliest_post_deploy_version+ @@earliest_post_deploy_version ||= begin+ first_file = Dir.glob("#{Discourse::DB_POST_MIGRATE_PATH}/*.rb").sort.first+ file_name = File.basename(first_file, ".rb")+ file_name.first(14).to_i+ end+ endend