diff options
Diffstat (limited to 'db/post_migrate/20211006145004_finalize_indexes_for_ci_job_artifacts_expire_at_unlocked.rb')
-rw-r--r-- | db/post_migrate/20211006145004_finalize_indexes_for_ci_job_artifacts_expire_at_unlocked.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/db/post_migrate/20211006145004_finalize_indexes_for_ci_job_artifacts_expire_at_unlocked.rb b/db/post_migrate/20211006145004_finalize_indexes_for_ci_job_artifacts_expire_at_unlocked.rb new file mode 100644 index 00000000000..b046ab6ab03 --- /dev/null +++ b/db/post_migrate/20211006145004_finalize_indexes_for_ci_job_artifacts_expire_at_unlocked.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class FinalizeIndexesForCiJobArtifactsExpireAtUnlocked < Gitlab::Database::Migration[1.0] + disable_ddl_transaction! + + TABLE_NAME = 'ci_job_artifacts' + INDEX_NAME = 'ci_job_artifacts_expire_at_unlocked_idx' + + def up + add_concurrent_index TABLE_NAME, [:expire_at], where: 'locked = 0', name: INDEX_NAME + end + + def down + remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME + end +end |