mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 09:46:09 +02:00
Merge branch 'add-uuid-db-columns' into registry-849
This commit is contained in:
commit
3d9ee8a611
3 changed files with 35 additions and 0 deletions
|
@ -16,6 +16,7 @@ module Concerns::Contact::Transferable
|
|||
new_contact.regenerate_code
|
||||
new_contact.regenerate_auth_info
|
||||
new_contact.remove_address unless self.class.address_processing?
|
||||
new_contact.uuid = nil
|
||||
new_contact.save(validate: false)
|
||||
new_contact
|
||||
end
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
# Unique constraint is needed to prevent accidental duplicate values in fixtures to appear in DB
|
||||
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
|
|
@ -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');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue