summaryrefslogtreecommitdiff
path: root/db/migrate/20221213105028_add_sync_part_step_2_of_index_namespaces_on_path_for_top_level_non_projects.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20221213105028_add_sync_part_step_2_of_index_namespaces_on_path_for_top_level_non_projects.rb')
-rw-r--r--db/migrate/20221213105028_add_sync_part_step_2_of_index_namespaces_on_path_for_top_level_non_projects.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20221213105028_add_sync_part_step_2_of_index_namespaces_on_path_for_top_level_non_projects.rb b/db/migrate/20221213105028_add_sync_part_step_2_of_index_namespaces_on_path_for_top_level_non_projects.rb
new file mode 100644
index 00000000000..c16cf3dd940
--- /dev/null
+++ b/db/migrate/20221213105028_add_sync_part_step_2_of_index_namespaces_on_path_for_top_level_non_projects.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddSyncPartStep2OfIndexNamespacesOnPathForTopLevelNonProjects < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'namespaces'
+ INDEX_NAME = 'index_namespaces_on_path_for_top_level_non_projects'
+ COLUMN = "lower((path)::text)"
+ CONDITIONS = "(parent_id IS NULL AND type::text <> 'Project'::text)"
+
+ def up
+ add_concurrent_index TABLE_NAME, COLUMN, name: INDEX_NAME, where: CONDITIONS
+ end
+
+ def down
+ remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
+ end
+end