From 94cd6e5ba0a8283632bd2b051adeb57e840b4952 Mon Sep 17 00:00:00 2001 From: Ladislav Smola Date: Wed, 14 Feb 2018 15:22:18 +0100 Subject: [PATCH] Separate index for ContainerVolume and PersistentVolume Separate index for ContainerVolume and PersistentVolume --- ...0109102659_add_unique_indexes_to_containers_tables.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/db/migrate/20180109102659_add_unique_indexes_to_containers_tables.rb b/db/migrate/20180109102659_add_unique_indexes_to_containers_tables.rb index 40d026549..969e9c346 100644 --- a/db/migrate/20180109102659_add_unique_indexes_to_containers_tables.rb +++ b/db/migrate/20180109102659_add_unique_indexes_to_containers_tables.rb @@ -69,9 +69,14 @@ def change :unique => true, :name => "index_container_template_parameters_unique_multi_column" add_index :container_volumes, - %i(parent_id parent_type ems_ref name), + %i(parent_id parent_type name ems_ref), :unique => true, - :name => "index_container_volumes_unique_multi_column" + :name => "index_container_volumes_unique_without_name" + add_index :container_volumes, + %i(parent_id parent_type name), + :where => "ems_ref IS NULL", + :unique => true, + :name => "index_container_volumes_unique_without_ems_ref" add_index :custom_attributes, %i(resource_id resource_type name section source), :unique => true,