2016-12-14 22:58:44 +00:00
|
|
|
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
|
2017-03-13 12:36:17 +00:00
|
|
|
remove_index :environments, [:project_id, :name]
|
|
|
|
add_concurrent_index :environments, [:project_id, :name], unique: true
|
2016-12-14 22:58:44 +00:00
|
|
|
end
|
|
|
|
end
|