summaryrefslogtreecommitdiff
path: root/db/migrate/20211202094944_move_loose_fk_deleted_records_to_dynamic_schema.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20211202094944_move_loose_fk_deleted_records_to_dynamic_schema.rb')
-rw-r--r--db/migrate/20211202094944_move_loose_fk_deleted_records_to_dynamic_schema.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20211202094944_move_loose_fk_deleted_records_to_dynamic_schema.rb b/db/migrate/20211202094944_move_loose_fk_deleted_records_to_dynamic_schema.rb
new file mode 100644
index 00000000000..84bc551d2b5
--- /dev/null
+++ b/db/migrate/20211202094944_move_loose_fk_deleted_records_to_dynamic_schema.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class MoveLooseFkDeletedRecordsToDynamicSchema < Gitlab::Database::Migration[1.0]
+ enable_lock_retries!
+
+ def up
+ if table_exists?('gitlab_partitions_static.loose_foreign_keys_deleted_records_1')
+ execute 'ALTER TABLE gitlab_partitions_static.loose_foreign_keys_deleted_records_1 SET SCHEMA gitlab_partitions_dynamic'
+ end
+ end
+
+ def down
+ if table_exists?('gitlab_partitions_dynamic.loose_foreign_keys_deleted_records_1')
+ execute 'ALTER TABLE gitlab_partitions_dynamic.loose_foreign_keys_deleted_records_1 SET SCHEMA gitlab_partitions_static'
+ end
+ end
+end