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/migrate/20210215172449_remove_artifact_expiry_temp_index.rb')
-rw-r--r--db/migrate/20210215172449_remove_artifact_expiry_temp_index.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20210215172449_remove_artifact_expiry_temp_index.rb b/db/migrate/20210215172449_remove_artifact_expiry_temp_index.rb
new file mode 100644
index 00000000000..1e6619731a2
--- /dev/null
+++ b/db/migrate/20210215172449_remove_artifact_expiry_temp_index.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class RemoveArtifactExpiryTempIndex < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'expired_artifacts_temp_index'
+ INDEX_CONDITION = "expire_at IS NULL AND date(created_at AT TIME ZONE 'UTC') < '2020-06-22'::date"
+
+ def up
+ remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME
+ end
+
+ def down
+ add_concurrent_index(:ci_job_artifacts, %i(id created_at), where: INDEX_CONDITION, name: INDEX_NAME)
+ end
+end