Replace index with constraint

#700
This commit is contained in:
Artur Beljajev 2018-02-12 17:50:48 +02:00
parent fa6edab62a
commit 5a101ddaf4
3 changed files with 30 additions and 7 deletions

View file

@ -0,0 +1,13 @@
class AddEppSessionsSessionIdUniqueConstraint < ActiveRecord::Migration
def up
execute <<-SQL
ALTER TABLE epp_sessions ADD CONSTRAINT unique_session_id UNIQUE (session_id)
SQL
end
def down
execute <<-SQL
ALTER TABLE epp_sessions DROP CONSTRAINT unique_session_id
SQL
end
end

View file

@ -0,0 +1,5 @@
class RemoveEppSessionsSessionIdUniqueIndex < ActiveRecord::Migration
def change
remove_index :epp_sessions, name: :index_epp_sessions_on_session_id
end
end