From 6ebb77fb5c6b8659d05cccab91afdda5c6d9e30f Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 16 Aug 2018 15:43:22 +0300 Subject: [PATCH] Change `contacts.email` to NOT NULL --- .../20180816123540_change_contacts_email_to_not_null.rb | 5 +++++ db/structure.sql | 4 +++- test/system/admin_area/contact_versions_test.rb | 4 ++-- test/system/admin_area/domain_versions_test.rb | 4 ++-- 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20180816123540_change_contacts_email_to_not_null.rb diff --git a/db/migrate/20180816123540_change_contacts_email_to_not_null.rb b/db/migrate/20180816123540_change_contacts_email_to_not_null.rb new file mode 100644 index 000000000..e6080e38b --- /dev/null +++ b/db/migrate/20180816123540_change_contacts_email_to_not_null.rb @@ -0,0 +1,5 @@ +class ChangeContactsEmailToNotNull < ActiveRecord::Migration + def change + change_column_null :contacts, :email, false + end +end \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index b07f08000..939b00565 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -613,7 +613,7 @@ CREATE TABLE public.contacts ( id integer NOT NULL, code character varying NOT NULL, phone character varying, - email character varying, + email character varying NOT NULL, fax character varying, created_at timestamp without time zone, updated_at timestamp without time zone, @@ -4757,3 +4757,5 @@ INSERT INTO schema_migrations (version) VALUES ('20180613030330'); INSERT INTO schema_migrations (version) VALUES ('20180613045614'); +INSERT INTO schema_migrations (version) VALUES ('20180816123540'); + diff --git a/test/system/admin_area/contact_versions_test.rb b/test/system/admin_area/contact_versions_test.rb index 10d20615a..8130706b6 100644 --- a/test/system/admin_area/contact_versions_test.rb +++ b/test/system/admin_area/contact_versions_test.rb @@ -21,8 +21,8 @@ class ContactVersionsTest < ApplicationSystemTestCase VALUES (75, 'test_registrar', 'test123', 'test@test.com', 'EE', 'TEST123', 'test123', 'en'); - INSERT INTO contacts (id, code, auth_info, registrar_id) - VALUES (75, 'test_code', '8b4d462aa04194ca78840a', 75); + INSERT INTO contacts (id, code, email, auth_info, registrar_id) + VALUES (75, 'test_code', 'test@inbox.test', '8b4d462aa04194ca78840a', 75); INSERT INTO log_contacts (item_type, item_id, event, whodunnit, object, object_changes, created_at, session, children, ident_updated_at, uuid) diff --git a/test/system/admin_area/domain_versions_test.rb b/test/system/admin_area/domain_versions_test.rb index 6c375cefe..dae7592c8 100644 --- a/test/system/admin_area/domain_versions_test.rb +++ b/test/system/admin_area/domain_versions_test.rb @@ -21,8 +21,8 @@ class DomainVersionsTest < ApplicationSystemTestCase VALUES (54, 'test_registrar', 'test123', 'test@test.com', 'EE', 'TEST123', 'test123', 'en'); - INSERT INTO contacts (id, code, auth_info, registrar_id) - VALUES (54, 'test_code', '8b4d462aa04194ca78840a', 54); + INSERT INTO contacts (id, code, email, auth_info, registrar_id) + VALUES (54, 'test_code', 'test@inbox.test', '8b4d462aa04194ca78840a', 54); INSERT INTO domains (id, registrar_id, valid_to, registrant_id, transfer_code)