From 3865225e98bf8c30134ddf924353435ceaf552ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 9 Aug 2021 23:51:23 +0200 Subject: [PATCH] Make migrations using remove_index reversible These issues were detected after upgrading to rubocop-rails >= 2.8.0. --- db/migrate/20171002103314_add_poll_shift_task_index.rb | 2 +- .../20171003095936_remove_officer_assigment_composed_index.rb | 2 +- .../20171003212958_add_date_to_poll_shift_composed_index.rb | 4 ++-- db/migrate/20190321144328_add_config_to_download_settings.rb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/db/migrate/20171002103314_add_poll_shift_task_index.rb b/db/migrate/20171002103314_add_poll_shift_task_index.rb index 3e28def56..8d283c7e1 100644 --- a/db/migrate/20171002103314_add_poll_shift_task_index.rb +++ b/db/migrate/20171002103314_add_poll_shift_task_index.rb @@ -1,6 +1,6 @@ class AddPollShiftTaskIndex < ActiveRecord::Migration[4.2] def change - remove_index "poll_shifts", name: "index_poll_shifts_on_booth_id_and_officer_id" + remove_index "poll_shifts", column: [:booth_id, :officer_id] add_index :poll_shifts, :task add_index :poll_shifts, [:booth_id, :officer_id, :task], unique: true end diff --git a/db/migrate/20171003095936_remove_officer_assigment_composed_index.rb b/db/migrate/20171003095936_remove_officer_assigment_composed_index.rb index 62e4d12cf..16772972b 100644 --- a/db/migrate/20171003095936_remove_officer_assigment_composed_index.rb +++ b/db/migrate/20171003095936_remove_officer_assigment_composed_index.rb @@ -1,5 +1,5 @@ class RemoveOfficerAssigmentComposedIndex < ActiveRecord::Migration[4.2] def change - remove_index "poll_officer_assignments", name: "index_poll_officer_assignments_on_officer_id_and_date" + remove_index "poll_officer_assignments", column: [:officer_id, :date] end end diff --git a/db/migrate/20171003212958_add_date_to_poll_shift_composed_index.rb b/db/migrate/20171003212958_add_date_to_poll_shift_composed_index.rb index 28c7e51ac..2b309b4bd 100644 --- a/db/migrate/20171003212958_add_date_to_poll_shift_composed_index.rb +++ b/db/migrate/20171003212958_add_date_to_poll_shift_composed_index.rb @@ -1,7 +1,7 @@ class AddDateToPollShiftComposedIndex < ActiveRecord::Migration[4.2] def change - remove_index "poll_shifts", name: "index_poll_shifts_on_booth_id_and_officer_id_and_task" - remove_index "poll_shifts", name: "index_poll_shifts_on_task" + remove_index "poll_shifts", column: [:booth_id, :officer_id, :task] + remove_index "poll_shifts", :task add_index :poll_shifts, [:booth_id, :officer_id, :date, :task], unique: true end end diff --git a/db/migrate/20190321144328_add_config_to_download_settings.rb b/db/migrate/20190321144328_add_config_to_download_settings.rb index 74c650011..5a5404026 100644 --- a/db/migrate/20190321144328_add_config_to_download_settings.rb +++ b/db/migrate/20190321144328_add_config_to_download_settings.rb @@ -2,7 +2,7 @@ class AddConfigToDownloadSettings < ActiveRecord::Migration[4.2] def change add_column :download_settings, :config, :integer, default: 0, null: false - remove_index :download_settings, name: "index_download_settings_on_name_model_and_name_field" + remove_index :download_settings, column: [:name_model, :name_field] add_index :download_settings, [:name_model, :name_field, :config], unique: true end end