2017-04-05 18:53:57 -04:00
|
|
|
# rubocop:disable RemoveIndex
|
2018-11-13 02:27:31 -05:00
|
|
|
class CreateEnvironmentNameUniqueIndex < ActiveRecord::Migration[4.2]
|
2016-12-14 17:58:44 -05:00
|
|
|
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 08:36:17 -04:00
|
|
|
remove_index :environments, [:project_id, :name]
|
|
|
|
add_concurrent_index :environments, [:project_id, :name], unique: true
|
2016-12-14 17:58:44 -05:00
|
|
|
end
|
|
|
|
end
|