diff options
Diffstat (limited to 'db/post_migrate/20220325000000_prepare_index_for_ci_job_artifacts_unlocked_with_expire_at.rb')
-rw-r--r-- | db/post_migrate/20220325000000_prepare_index_for_ci_job_artifacts_unlocked_with_expire_at.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/db/post_migrate/20220325000000_prepare_index_for_ci_job_artifacts_unlocked_with_expire_at.rb b/db/post_migrate/20220325000000_prepare_index_for_ci_job_artifacts_unlocked_with_expire_at.rb new file mode 100644 index 00000000000..fa43f3b7f59 --- /dev/null +++ b/db/post_migrate/20220325000000_prepare_index_for_ci_job_artifacts_unlocked_with_expire_at.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class PrepareIndexForCiJobArtifactsUnlockedWithExpireAt < Gitlab::Database::Migration[1.0] + TABLE_NAME = 'ci_job_artifacts' + INDEX_NAME = 'index_ci_job_artifacts_on_expire_at_for_removal' + CONDITIONS = 'locked = 0 AND expire_at IS NOT NULL' + + def up + prepare_async_index TABLE_NAME, [:expire_at], where: CONDITIONS, name: INDEX_NAME + end + + def down + unprepare_async_index_by_name TABLE_NAME, INDEX_NAME + end +end |