diff --git a/db/migrate/20180212152810_add_epp_sessions_session_id_unique_constraint.rb b/db/migrate/20180212152810_add_epp_sessions_session_id_unique_constraint.rb new file mode 100644 index 000000000..7eac99e63 --- /dev/null +++ b/db/migrate/20180212152810_add_epp_sessions_session_id_unique_constraint.rb @@ -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 diff --git a/db/migrate/20180212154731_remove_epp_sessions_session_id_unique_index.rb b/db/migrate/20180212154731_remove_epp_sessions_session_id_unique_index.rb new file mode 100644 index 000000000..47fb20157 --- /dev/null +++ b/db/migrate/20180212154731_remove_epp_sessions_session_id_unique_index.rb @@ -0,0 +1,5 @@ +class RemoveEppSessionsSessionIdUniqueIndex < ActiveRecord::Migration + def change + remove_index :epp_sessions, name: :index_epp_sessions_on_session_id + end +end diff --git a/db/structure.sql b/db/structure.sql index f7fdc5148..e743e42f6 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -3634,6 +3634,14 @@ ALTER TABLE ONLY contacts ADD CONSTRAINT unique_contact_code UNIQUE (code); +-- +-- Name: unique_session_id; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY epp_sessions + ADD CONSTRAINT unique_session_id UNIQUE (session_id); + + -- -- Name: unique_zone_origin; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- @@ -3885,13 +3893,6 @@ CREATE INDEX index_domains_on_registrar_id ON domains USING btree (registrar_id) CREATE INDEX index_domains_on_statuses ON domains USING gin (statuses); --- --- Name: index_epp_sessions_on_session_id; Type: INDEX; Schema: public; Owner: -; Tablespace: --- - -CREATE UNIQUE INDEX index_epp_sessions_on_session_id ON epp_sessions USING btree (session_id); - - -- -- Name: index_epp_sessions_on_updated_at; Type: INDEX; Schema: public; Owner: -; Tablespace: -- @@ -5087,3 +5088,7 @@ INSERT INTO schema_migrations (version) VALUES ('20180207072139'); INSERT INTO schema_migrations (version) VALUES ('20180212123810'); +INSERT INTO schema_migrations (version) VALUES ('20180212152810'); + +INSERT INTO schema_migrations (version) VALUES ('20180212154731'); +