From 5f38188f927ee56ea47bf2d1fd84d76e8da206e1 Mon Sep 17 00:00:00 2001 From: Katharina Przybill <30441792+kathap@users.noreply.github.com> Date: Thu, 25 Aug 2022 15:13:29 +0200 Subject: [PATCH] Adapt index name, drop old index before creating the unique one --- ...ndex_to_service_instance_operations_service_instance_id.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/migrations/20220818142407_add_unique_index_to_service_instance_operations_service_instance_id.rb b/db/migrations/20220818142407_add_unique_index_to_service_instance_operations_service_instance_id.rb index b443e56fbaf..dee413178f5 100644 --- a/db/migrations/20220818142407_add_unique_index_to_service_instance_operations_service_instance_id.rb +++ b/db/migrations/20220818142407_add_unique_index_to_service_instance_operations_service_instance_id.rb @@ -11,12 +11,14 @@ self[:service_instance_operations].where(id: row[:id]).delete end alter_table :service_instance_operations do - add_index :service_instance_id, name: :service_instance_operations_service_instance_id_unique_index, unique: true + drop_index :service_instance_id, name: :svc_instance_id_index, if_exists: true + add_index :service_instance_id, name: :svc_inst_op_svc_instance_id_unique_index, unique: true end end down do alter_table :service_instance_operations do drop_index :service_instance_id + add_index :service_instance_id, name: :svc_instance_id_index end end end