Skip to content

Commit

Permalink
Replace index with constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Beljajev committed Feb 12, 2018
1 parent fa6edab commit 5a101dd
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveEppSessionsSessionIdUniqueIndex < ActiveRecord::Migration
def change
remove_index :epp_sessions, name: :index_epp_sessions_on_session_id
end
end
19 changes: 12 additions & 7 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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:
--
Expand Down Expand Up @@ -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:
--
Expand Down Expand Up @@ -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');

0 comments on commit 5a101dd

Please sign in to comment.