Make migrations using remove_index reversible

These issues were detected after upgrading to rubocop-rails >= 2.8.0.
This commit is contained in:
Javi Martín
2021-08-09 23:51:23 +02:00
parent 884fd2b27b
commit 3865225e98
4 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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