diff --git a/db/migrate/20250304041850_add_index_to_post_stat_composer_columns.rb b/db/migrate/20250304041850_add_index_to_post_stat_composer_columns.rb deleted file mode 100644 index 22bf20b135b..00000000000 --- a/db/migrate/20250304041850_add_index_to_post_stat_composer_columns.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -class AddIndexToPostStatComposerColumns < ActiveRecord::Migration[7.2] - disable_ddl_transaction! - - def up - if !index_exists?(:post_stats, :composer_version) - add_index :post_stats, :composer_version, algorithm: :concurrently - end - if !index_exists?(:post_stats, :writing_device) - add_index :post_stats, :writing_device, algorithm: :concurrently - end - end - - def down - remove_index :post_stats, :composer_version if index_exists?(:post_stats, :composer_version) - remove_index :post_stats, :writing_device if index_exists?(:post_stats, :writing_device) - end -end diff --git a/db/migrate/20250311041851_add_index_to_post_stat_composer_columns.rb b/db/migrate/20250311041851_add_index_to_post_stat_composer_columns.rb new file mode 100644 index 00000000000..31a88c9d32e --- /dev/null +++ b/db/migrate/20250311041851_add_index_to_post_stat_composer_columns.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddIndexToPostStatComposerColumns < ActiveRecord::Migration[7.2] + disable_ddl_transaction! + + def up + remove_index :post_stats, :composer_version, algorithm: :concurrently, if_exists: true + remove_index :post_stats, :writing_device, algorithm: :concurrently, if_exists: true + add_index :post_stats, :composer_version, algorithm: :concurrently + add_index :post_stats, :writing_device, algorithm: :concurrently + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end