Commit 338c9e64 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '341814_replace_namespaces_name_parent_unique_index' into 'master'

Replace namespaces unique index on name and parent_id

See merge request gitlab-org/gitlab!71390
parents 8d828b2e db628d9d
# frozen_string_literal: true
class AddUniqueNamespacesIndexOnNameParentIdAndType < Gitlab::Database::Migration[1.0]
INDEX_NAME = 'index_namespaces_name_parent_id_type'
disable_ddl_transaction!
def up
add_concurrent_index :namespaces, [:name, :parent_id, :type], unique: true, name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :namespaces, INDEX_NAME
end
end
# frozen_string_literal: true
class DropUniqueNamespacesIndexOnNameAndParentId < Gitlab::Database::Migration[1.0]
INDEX_NAME = 'index_namespaces_on_name_and_parent_id'
disable_ddl_transaction!
def up
remove_concurrent_index_by_name :namespaces, INDEX_NAME
end
def down
add_concurrent_index :namespaces, [:name, :parent_id], unique: true, name: INDEX_NAME
end
end
c50ccd9986188356776c2d19c5544a6da6e31b5bb1b16ed259455604cb6fd862
\ No newline at end of file
083b18b8e687ae8ff9d93ee77c6d4fc2916a2f1b77acf44132f216236b0ff06c
\ No newline at end of file
...@@ -25683,6 +25683,8 @@ CREATE INDEX index_namespaces_id_parent_id_is_not_null ON namespaces USING btree ...@@ -25683,6 +25683,8 @@ CREATE INDEX index_namespaces_id_parent_id_is_not_null ON namespaces USING btree
CREATE INDEX index_namespaces_id_parent_id_is_null ON namespaces USING btree (id) WHERE (parent_id IS NULL); CREATE INDEX index_namespaces_id_parent_id_is_null ON namespaces USING btree (id) WHERE (parent_id IS NULL);
CREATE UNIQUE INDEX index_namespaces_name_parent_id_type ON namespaces USING btree (name, parent_id, type);
CREATE INDEX index_namespaces_on_created_at ON namespaces USING btree (created_at); CREATE INDEX index_namespaces_on_created_at ON namespaces USING btree (created_at);
CREATE INDEX index_namespaces_on_custom_project_templates_group_id_and_type ON namespaces USING btree (custom_project_templates_group_id, type) WHERE (custom_project_templates_group_id IS NOT NULL); CREATE INDEX index_namespaces_on_custom_project_templates_group_id_and_type ON namespaces USING btree (custom_project_templates_group_id, type) WHERE (custom_project_templates_group_id IS NOT NULL);
...@@ -25693,8 +25695,6 @@ CREATE INDEX index_namespaces_on_ldap_sync_last_successful_update_at ON namespac ...@@ -25693,8 +25695,6 @@ CREATE INDEX index_namespaces_on_ldap_sync_last_successful_update_at ON namespac
CREATE INDEX index_namespaces_on_ldap_sync_last_update_at ON namespaces USING btree (ldap_sync_last_update_at); CREATE INDEX index_namespaces_on_ldap_sync_last_update_at ON namespaces USING btree (ldap_sync_last_update_at);
CREATE UNIQUE INDEX index_namespaces_on_name_and_parent_id ON namespaces USING btree (name, parent_id);
CREATE INDEX index_namespaces_on_name_trigram ON namespaces USING gin (name gin_trgm_ops); CREATE INDEX index_namespaces_on_name_trigram ON namespaces USING gin (name gin_trgm_ops);
CREATE INDEX index_namespaces_on_owner_id ON namespaces USING btree (owner_id); CREATE INDEX index_namespaces_on_owner_id ON namespaces USING btree (owner_id);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment