BigW Consortium Gitlab

20161207231621_create_environment_name_unique_index.rb 549 Bytes
Newer Older
1
# rubocop:disable RemoveIndex
2 3 4 5 6 7 8 9 10 11 12 13 14 15
class CreateEnvironmentNameUniqueIndex < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  disable_ddl_transaction!

  DOWNTIME = true
  DOWNTIME_REASON = 'Making a non-unique index into a unique index'

  def up
    remove_index :environments, [:project_id, :name]
    add_concurrent_index :environments, [:project_id, :name], unique: true
  end

  def down
16 17
    remove_index :environments, [:project_id, :name]
    add_concurrent_index :environments, [:project_id, :name], unique: true
18 19
  end
end