Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20220510003916_remove_tmp_empty_traversal_ids_root_namespace_index.rb')
-rw-r--r--db/post_migrate/20220510003916_remove_tmp_empty_traversal_ids_root_namespace_index.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/db/post_migrate/20220510003916_remove_tmp_empty_traversal_ids_root_namespace_index.rb b/db/post_migrate/20220510003916_remove_tmp_empty_traversal_ids_root_namespace_index.rb
new file mode 100644
index 00000000000..424c6f164e7
--- /dev/null
+++ b/db/post_migrate/20220510003916_remove_tmp_empty_traversal_ids_root_namespace_index.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class RemoveTmpEmptyTraversalIdsRootNamespaceIndex < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ ROOT_NS_INDEX_NAME = 'tmp_index_namespaces_empty_traversal_ids_with_root_namespaces'
+
+ def up
+ remove_concurrent_index :namespaces, :id, name: ROOT_NS_INDEX_NAME
+ end
+
+ def down
+ where_sql = "parent_id IS NULL AND traversal_ids = '{}'"
+ add_concurrent_index :namespaces, :id, where: where_sql, name: ROOT_NS_INDEX_NAME
+ end
+end