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

class AddIndexToServiceUniqueTemplatePerType < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index(:services, [:type, :template], unique: true, where: 'template IS TRUE')
  end

  def down
    remove_concurrent_index(:services, [:type, :template])
  end
end