From ff086956412afa0bb3ff55d5bab1699d78494e54 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 25 Jun 2024 11:25:37 -0400 Subject: [PATCH] Fix `Rails/ReversibleMigration` cop for `remove_index` --- db/migrate/20161122163057_remove_unneeded_indexes.rb | 6 +++--- db/migrate/20171129172043_add_index_on_stream_entries.rb | 2 +- .../20171212195226_remove_duplicate_indexes_in_lists.rb | 4 ++-- .../20171226094803_more_faster_index_on_notifications.rb | 2 +- ...x_on_statuses_for_api_v1_accounts_account_id_statuses.rb | 2 +- db/migrate/20180617162849_remove_unused_indexes.rb | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/db/migrate/20161122163057_remove_unneeded_indexes.rb b/db/migrate/20161122163057_remove_unneeded_indexes.rb index 7ed92127d70..24961847038 100644 --- a/db/migrate/20161122163057_remove_unneeded_indexes.rb +++ b/db/migrate/20161122163057_remove_unneeded_indexes.rb @@ -2,8 +2,8 @@ class RemoveUnneededIndexes < ActiveRecord::Migration[5.0] def change - remove_index :notifications, name: 'index_notifications_on_account_id' - remove_index :settings, name: 'index_settings_on_target_type_and_target_id' - remove_index :statuses_tags, name: 'index_statuses_tags_on_tag_id' + remove_index :notifications, :account_id, name: 'index_notifications_on_account_id' + remove_index :settings, [:target_type, :target_id], name: 'index_settings_on_target_type_and_target_id' + remove_index :statuses_tags, :tag_id, name: 'index_statuses_tags_on_tag_id' end end diff --git a/db/migrate/20171129172043_add_index_on_stream_entries.rb b/db/migrate/20171129172043_add_index_on_stream_entries.rb index c959135c22a..e861cdc2d1c 100644 --- a/db/migrate/20171129172043_add_index_on_stream_entries.rb +++ b/db/migrate/20171129172043_add_index_on_stream_entries.rb @@ -5,6 +5,6 @@ class AddIndexOnStreamEntries < ActiveRecord::Migration[5.2] def change add_index :stream_entries, [:account_id, :activity_type, :id], algorithm: :concurrently - remove_index :stream_entries, name: :index_stream_entries_on_account_id + remove_index :stream_entries, :account_id, name: :index_stream_entries_on_account_id end end diff --git a/db/migrate/20171212195226_remove_duplicate_indexes_in_lists.rb b/db/migrate/20171212195226_remove_duplicate_indexes_in_lists.rb index 362b1367df9..6f51f0a0631 100644 --- a/db/migrate/20171212195226_remove_duplicate_indexes_in_lists.rb +++ b/db/migrate/20171212195226_remove_duplicate_indexes_in_lists.rb @@ -2,7 +2,7 @@ class RemoveDuplicateIndexesInLists < ActiveRecord::Migration[5.2] def change - remove_index :list_accounts, name: 'index_list_accounts_on_account_id' - remove_index :list_accounts, name: 'index_list_accounts_on_list_id' + remove_index :list_accounts, :account_id, name: 'index_list_accounts_on_account_id' + remove_index :list_accounts, :list_id, name: 'index_list_accounts_on_list_id' end end diff --git a/db/migrate/20171226094803_more_faster_index_on_notifications.rb b/db/migrate/20171226094803_more_faster_index_on_notifications.rb index 429eab96a18..b2fc040e2e2 100644 --- a/db/migrate/20171226094803_more_faster_index_on_notifications.rb +++ b/db/migrate/20171226094803_more_faster_index_on_notifications.rb @@ -5,6 +5,6 @@ class MoreFasterIndexOnNotifications < ActiveRecord::Migration[5.2] def change add_index :notifications, [:account_id, :id], order: { id: :desc }, algorithm: :concurrently - remove_index :notifications, name: :index_notifications_on_id_and_account_id_and_activity_type + remove_index :notifications, [:id, :account_id, :activity_type], name: :index_notifications_on_id_and_account_id_and_activity_type end end diff --git a/db/migrate/20180106000232_add_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb b/db/migrate/20180106000232_add_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb index 1531c4dd292..4c3a25e838a 100644 --- a/db/migrate/20180106000232_add_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb +++ b/db/migrate/20180106000232_add_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb @@ -7,6 +7,6 @@ class AddIndexOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecord::Migrat safety_assured do add_index :statuses, [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106 end - remove_index :statuses, name: :index_statuses_on_account_id_id + remove_index :statuses, [:account_id, :id], name: :index_statuses_on_account_id_id end end diff --git a/db/migrate/20180617162849_remove_unused_indexes.rb b/db/migrate/20180617162849_remove_unused_indexes.rb index 14766589fde..cf8faceb3ad 100644 --- a/db/migrate/20180617162849_remove_unused_indexes.rb +++ b/db/migrate/20180617162849_remove_unused_indexes.rb @@ -2,8 +2,8 @@ class RemoveUnusedIndexes < ActiveRecord::Migration[5.2] def change - remove_index :statuses, name: 'index_statuses_on_conversation_id' - remove_index :users, name: 'index_users_on_filtered_languages' - remove_index :backups, name: 'index_backups_on_user_id' + remove_index :statuses, :conversation_id, name: 'index_statuses_on_conversation_id' + remove_index :users, :filtered_languages, name: 'index_users_on_filtered_languages' + remove_index :backups, :user_id, name: 'index_backups_on_user_id' end end