diff --git a/app/models/contact.rb b/app/models/contact.rb index d45597d3c..1373ff97d 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -288,7 +288,7 @@ class Contact < ApplicationRecord end def to_s - name || '[no name]' + name end def validate_html diff --git a/db/migrate/20180801114403_change_contacts_name_to_not_null.rb b/db/migrate/20180801114403_change_contacts_name_to_not_null.rb new file mode 100644 index 000000000..cfa4064ba --- /dev/null +++ b/db/migrate/20180801114403_change_contacts_name_to_not_null.rb @@ -0,0 +1,5 @@ +class ChangeContactsNameToNotNull < ActiveRecord::Migration + def change + change_column_null :contacts, :name, false + end +end \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 32ec2eb15..16d6d1d21 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -613,7 +613,7 @@ CREATE TABLE public.contacts ( ident character varying, ident_type character varying, auth_info character varying NOT NULL, - name character varying, + name character varying NOT NULL, org_name character varying, registrar_id integer NOT NULL, creator_str character varying, @@ -4280,6 +4280,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20180613030330'), ('20180613045614'), ('20180713154915'), +('20180801114403'), ('20180808064402'), ('20180816123540'), ('20180823161237'), diff --git a/test/system/admin_area/contact_versions_test.rb b/test/system/admin_area/contact_versions_test.rb index 88d625c41..2559a203f 100644 --- a/test/system/admin_area/contact_versions_test.rb +++ b/test/system/admin_area/contact_versions_test.rb @@ -18,8 +18,8 @@ class ContactVersionsTest < ApplicationSystemTestCase def create_contact_with_history sql = <<-SQL.squish - INSERT INTO contacts (id, code, email, auth_info, registrar_id) - VALUES (75, 'test_code', 'test@inbox.test', '8b4d462aa04194ca78840a', #{@registrar.id}); + INSERT INTO contacts (id, name, code, email, auth_info, registrar_id) + VALUES (75, 'test_name', 'test_code', 'test@inbox.test', '8b4d462aa04194ca78840a', #{@registrar.id}); INSERT INTO log_contacts (item_type, item_id, event, whodunnit, object, object_changes, created_at, session, children, ident_updated_at, uuid) @@ -55,4 +55,4 @@ class ContactVersionsTest < ApplicationSystemTestCase assert_text 'Best Names' assert_text '23.04.18, 18:50 update 1-AdminUser' end -end \ No newline at end of file +end diff --git a/test/system/admin_area/domain_versions_test.rb b/test/system/admin_area/domain_versions_test.rb index 73db8d707..8ff90a562 100644 --- a/test/system/admin_area/domain_versions_test.rb +++ b/test/system/admin_area/domain_versions_test.rb @@ -18,8 +18,8 @@ class DomainVersionsTest < ApplicationSystemTestCase def create_domain_with_history sql = <<-SQL.squish - INSERT INTO contacts (id, code, email, auth_info, registrar_id) - VALUES (54, 'test_code', 'test@inbox.test', '8b4d462aa04194ca78840a', #{@registrar.id}); + INSERT INTO contacts (id, name, code, email, auth_info, registrar_id) + VALUES (54, 'test_code', 'test_name', 'test@inbox.test', '8b4d462aa04194ca78840a', #{@registrar.id}); INSERT INTO domains (id, name, name_puny, name_dirty, registrar_id, valid_to, registrant_id, transfer_code) @@ -59,4 +59,4 @@ class DomainVersionsTest < ApplicationSystemTestCase assert_text 'Best Names' assert_text '23.04.18, 18:50 update 1-AdminUser' end -end \ No newline at end of file +end