summaryrefslogtreecommitdiff
path: root/db/post_migrate/20220120123700_add_tmp_index_routes_id_for_namespaces.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20220120123700_add_tmp_index_routes_id_for_namespaces.rb')
-rw-r--r--db/post_migrate/20220120123700_add_tmp_index_routes_id_for_namespaces.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/post_migrate/20220120123700_add_tmp_index_routes_id_for_namespaces.rb b/db/post_migrate/20220120123700_add_tmp_index_routes_id_for_namespaces.rb
new file mode 100644
index 00000000000..2b8cecd0e57
--- /dev/null
+++ b/db/post_migrate/20220120123700_add_tmp_index_routes_id_for_namespaces.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddTmpIndexRoutesIdForNamespaces < Gitlab::Database::Migration[1.0]
+ INDEX_NAME = 'tmp_index_for_namespace_id_migration_on_routes'
+
+ disable_ddl_transaction!
+
+ def up
+ # Temporary index to be removed in 14.9
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/352353
+ add_concurrent_index :routes, :id, where: "routes.namespace_id is null and routes.source_type = 'Namespace'", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index_by_name :routes, INDEX_NAME
+ end
+end