summaryrefslogtreecommitdiff
path: root/db/post_migrate/20210621111747_add_ci_artifacts_devops_adoption_index.rb
blob: 71fd61072ac19bd5bcaf90f9216b7543ff4d50c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true
#
class AddCiArtifactsDevopsAdoptionIndex < ActiveRecord::Migration[6.1]
  include Gitlab::Database::MigrationHelpers

  disable_ddl_transaction!

  NEW_INDEX = 'index_ci_job_artifacts_on_file_type_for_devops_adoption'

  def up
    add_concurrent_index :ci_job_artifacts, [:file_type, :project_id, :created_at], name: NEW_INDEX, where: 'file_type IN (5,6,8,23)'
  end

  def down
    remove_concurrent_index_by_name :ci_job_artifacts, NEW_INDEX
  end
end