summaryrefslogtreecommitdiff
path: root/db/post_migrate/20210614124111_add_devops_adoption_sast_dast_indexes.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20210614124111_add_devops_adoption_sast_dast_indexes.rb')
-rw-r--r--db/post_migrate/20210614124111_add_devops_adoption_sast_dast_indexes.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/db/post_migrate/20210614124111_add_devops_adoption_sast_dast_indexes.rb b/db/post_migrate/20210614124111_add_devops_adoption_sast_dast_indexes.rb
new file mode 100644
index 00000000000..9d40fe30ed6
--- /dev/null
+++ b/db/post_migrate/20210614124111_add_devops_adoption_sast_dast_indexes.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class AddDevopsAdoptionSastDastIndexes < ActiveRecord::Migration[6.1]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ INDEX_SAST = 'index_ci_job_artifacts_sast_for_devops_adoption'
+ INDEX_DAST = 'index_ci_job_artifacts_dast_for_devops_adoption'
+
+ def up
+ add_concurrent_index :ci_job_artifacts, [:project_id, :created_at], where: "file_type = 5", name: INDEX_SAST
+ add_concurrent_index :ci_job_artifacts, [:project_id, :created_at], where: "file_type = 8", name: INDEX_DAST
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_job_artifacts, INDEX_SAST
+ remove_concurrent_index_by_name :ci_job_artifacts, INDEX_DAST
+ end
+end