Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20220511212620_add_index_on_expirable_unknown_artifacts_for_removal.rb')
-rw-r--r--db/post_migrate/20220511212620_add_index_on_expirable_unknown_artifacts_for_removal.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/post_migrate/20220511212620_add_index_on_expirable_unknown_artifacts_for_removal.rb b/db/post_migrate/20220511212620_add_index_on_expirable_unknown_artifacts_for_removal.rb
new file mode 100644
index 00000000000..fc9912d714e
--- /dev/null
+++ b/db/post_migrate/20220511212620_add_index_on_expirable_unknown_artifacts_for_removal.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexOnExpirableUnknownArtifactsForRemoval < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ TABLE_NAME = 'ci_job_artifacts'
+ INDEX_NAME = 'tmp_index_ci_job_artifacts_on_expire_at_where_locked_unknown'
+ CONDITIONS = 'locked = 2 AND expire_at IS NOT NULL'
+
+ def up
+ add_concurrent_index TABLE_NAME, [:expire_at, :job_id], name: INDEX_NAME, where: CONDITIONS
+ end
+
+ def down
+ remove_concurrent_index_by_name TABLE_NAME, INDEX_NAME
+ end
+end