summaryrefslogtreecommitdiff
path: root/db/migrate/20220505092254_add_allow_stale_runner_pruning_index_to_namespace_ci_cd_settings.rb
blob: b7fd8fdee4fab965b886f7b38b1a495761eca7d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

class AddAllowStaleRunnerPruningIndexToNamespaceCiCdSettings < Gitlab::Database::Migration[2.0]
  INDEX_NAME = 'index_cicd_settings_on_namespace_id_where_stale_pruning_enabled'

  disable_ddl_transaction!

  def up
    add_concurrent_index :namespace_ci_cd_settings,
      :namespace_id,
      where: '(allow_stale_runner_pruning = true)',
      name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :namespace_ci_cd_settings, INDEX_NAME
  end
end