diff options
Diffstat (limited to 'db/post_migrate/20211011104843_add_new_loose_fk_index.rb')
-rw-r--r-- | db/post_migrate/20211011104843_add_new_loose_fk_index.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/db/post_migrate/20211011104843_add_new_loose_fk_index.rb b/db/post_migrate/20211011104843_add_new_loose_fk_index.rb new file mode 100644 index 00000000000..710d0917d7f --- /dev/null +++ b/db/post_migrate/20211011104843_add_new_loose_fk_index.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class AddNewLooseFkIndex < Gitlab::Database::Migration[1.0] + include Gitlab::Database::PartitioningMigrationHelpers + + disable_ddl_transaction! + + INDEX_NAME = 'index_loose_foreign_keys_deleted_records_for_loading_records' + + def up + add_concurrent_partitioned_index :loose_foreign_keys_deleted_records, + %I[fully_qualified_table_name id primary_key_value partition], + where: 'status = 1', + name: INDEX_NAME + end + + def down + remove_concurrent_partitioned_index_by_name :loose_foreign_keys_deleted_records, INDEX_NAME + end +end |