debian-mirror-gitlab/db/migrate/20200310135823_add_index_to_service_unique_instance_per_type.rb
2020-04-08 14:13:33 +05:30

18 lines
394 B
Ruby

# frozen_string_literal: true
class AddIndexToServiceUniqueInstancePerType < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index(:services, [:type, :instance], unique: true, where: 'instance IS TRUE')
end
def down
remove_concurrent_index(:services, [:type, :instance])
end
end