Add contacts.uuid and domains.uuid uniq constraints

This commit is contained in:
Artur Beljajev 2018-06-13 08:03:19 +03:00
parent 5626c87e04
commit 183eca884e
2 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,15 @@
class AddContactsAndDomainsUuidUniqConstraint < ActiveRecord::Migration
def up
execute <<-SQL
ALTER TABLE contacts ADD CONSTRAINT uniq_contact_uuid UNIQUE (uuid);
ALTER TABLE domains ADD CONSTRAINT uniq_domain_uuid UNIQUE (uuid);
SQL
end
def down
execute <<-SQL
ALTER TABLE contacts DROP CONSTRAINT uniq_contact_uuid;
ALTER TABLE domains DROP CONSTRAINT uniq_domain_uuid;
SQL
end
end

View file

@ -3258,6 +3258,22 @@ ALTER TABLE ONLY settings
ADD CONSTRAINT settings_pkey PRIMARY KEY (id);
--
-- Name: uniq_contact_uuid; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY contacts
ADD CONSTRAINT uniq_contact_uuid UNIQUE (uuid);
--
-- Name: uniq_domain_uuid; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY domains
ADD CONSTRAINT uniq_domain_uuid UNIQUE (uuid);
--
-- Name: unique_code; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
@ -4740,3 +4756,5 @@ INSERT INTO schema_migrations (version) VALUES ('20180612042953');
INSERT INTO schema_migrations (version) VALUES ('20180613030330');
INSERT INTO schema_migrations (version) VALUES ('20180613045614');