From 5626c87e04c4fd1ac9ce4135ced23ba9dbbe5928 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Wed, 13 Jun 2018 07:27:29 +0300 Subject: [PATCH] Change `contacts.uuid` and `domains.uuid` to NOT NULL --- ...030330_change_contacts_and_domains_uuid_to_not_null.rb | 6 ++++++ db/structure.sql | 6 ++++-- test/fixtures/contacts.yml | 8 ++++++++ test/fixtures/domains.yml | 5 +++++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20180613030330_change_contacts_and_domains_uuid_to_not_null.rb diff --git a/db/migrate/20180613030330_change_contacts_and_domains_uuid_to_not_null.rb b/db/migrate/20180613030330_change_contacts_and_domains_uuid_to_not_null.rb new file mode 100644 index 000000000..9d7641082 --- /dev/null +++ b/db/migrate/20180613030330_change_contacts_and_domains_uuid_to_not_null.rb @@ -0,0 +1,6 @@ +class ChangeContactsAndDomainsUuidToNotNull < ActiveRecord::Migration + def change + change_column_null :contacts, :uuid, false + change_column_null :domains, :uuid, false + end +end diff --git a/db/structure.sql b/db/structure.sql index cf2f858b4..9b53ad323 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -640,7 +640,7 @@ CREATE TABLE contacts ( ident_updated_at timestamp without time zone, upid integer, up_date timestamp without time zone, - uuid uuid DEFAULT gen_random_uuid() + uuid uuid DEFAULT gen_random_uuid() NOT NULL ); @@ -913,7 +913,7 @@ CREATE TABLE domains ( statuses_backup character varying[] DEFAULT '{}'::character varying[], upid integer, up_date timestamp without time zone, - uuid uuid DEFAULT gen_random_uuid() + uuid uuid DEFAULT gen_random_uuid() NOT NULL ); @@ -4738,3 +4738,5 @@ INSERT INTO schema_migrations (version) VALUES ('20180612042625'); INSERT INTO schema_migrations (version) VALUES ('20180612042953'); +INSERT INTO schema_migrations (version) VALUES ('20180613030330'); + diff --git a/test/fixtures/contacts.yml b/test/fixtures/contacts.yml index b64dce039..1f2e4b8da 100644 --- a/test/fixtures/contacts.yml +++ b/test/fixtures/contacts.yml @@ -8,6 +8,7 @@ john: registrar: bestnames code: john-001 auth_info: cacb5b + uuid: eb2f2766-b44c-4e14-9f16-32ab1a7cb957 william: &william name: William @@ -27,6 +28,7 @@ william: &william country_code: US statuses: - ok + uuid: 0aa54704-d6f7-4ca9-b8ca-2827d9a4e4eb jane: name: Jane @@ -38,6 +40,7 @@ jane: registrar: bestnames code: jane-001 auth_info: 0aa09f + uuid: 9db3de62-2414-4487-bee2-d5c155567768 acme_ltd: name: Acme Ltd @@ -49,6 +52,7 @@ acme_ltd: ident_country_code: US code: acme-ltd-001 auth_info: 720b3c + uuid: f1dd365c-5be9-4b3d-a44e-3fa002465e4d jack: name: Jack @@ -60,12 +64,14 @@ jack: ident_country_code: US code: jack-001 auth_info: e2c440 + uuid: 28b65455-6f1a-49fd-961c-0758886dbd75 identical_to_william: <<: *william registrar: goodnames code: william-002 auth_info: 5ab865 + uuid: c0a191d5-3793-4f0b-8f85-491612d0293e not_in_use: name: Useless @@ -73,6 +79,7 @@ not_in_use: registrar: bestnames code: useless-001 auth_info: e75a2a + uuid: ca613cc5-a8dc-48c1-8d32-d3c6a0b6c952 invalid: name: any @@ -80,3 +87,4 @@ invalid: email: invalid@invalid.test auth_info: any registrar: bestnames + uuid: bd80c0f9-26ee-49e0-a2cb-2311d931c433 \ No newline at end of file diff --git a/test/fixtures/domains.yml b/test/fixtures/domains.yml index 53de2837b..59a1b8ea5 100644 --- a/test/fixtures/domains.yml +++ b/test/fixtures/domains.yml @@ -7,6 +7,7 @@ shop: valid_to: 2010-07-05 period: 1 period_unit: m + uuid: 1b3ee442-e8fe-4922-9492-8fcb9dccc69c airport: name: airport.test @@ -17,6 +18,7 @@ airport: valid_to: 2010-07-05 period: 1 period_unit: m + uuid: 2df2c1a1-8f6a-490a-81be-8bdf29866880 library: name: library.test @@ -27,6 +29,7 @@ library: valid_to: 2010-07-05 period: 1 period_unit: m + uuid: 647bcc48-8d5e-4a04-8ce5-2a3cd17b6eab metro: name: metro.test @@ -37,6 +40,7 @@ metro: valid_to: 2010-07-05 period: 1 period_unit: m + uuid: ef97cb80-333b-4893-b9df-163f2b452798 invalid: name: invalid.test @@ -44,3 +48,4 @@ invalid: valid_to: <%= Time.zone.parse('2010-07-05').utc.to_s(:db) %> registrar: bestnames registrant: invalid + uuid: 3c430ead-bb17-4b5b-aaa1-caa7dde7e138 \ No newline at end of file