From 6fd172adbbf1033a5d154b64ac61a2d59e6a5cb7 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Fri, 6 Dec 2019 20:47:57 +0200 Subject: [PATCH] Remove `registrant_verifications.domain_name` database column It is not used nor needed. --- app/controllers/admin/pending_deletes_controller.rb | 1 - app/controllers/admin/pending_updates_controller.rb | 1 - .../registrant/domain_delete_confirms_controller.rb | 1 - .../registrant/domain_update_confirms_controller.rb | 1 - app/models/registrant_verification.rb | 2 +- ...1206183853_remove_registrant_verifications_domain_name.rb | 5 +++++ db/structure.sql | 4 ++-- 7 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20191206183853_remove_registrant_verifications_domain_name.rb diff --git a/app/controllers/admin/pending_deletes_controller.rb b/app/controllers/admin/pending_deletes_controller.rb index 9cc8702c5..8e39b306b 100644 --- a/app/controllers/admin/pending_deletes_controller.rb +++ b/app/controllers/admin/pending_deletes_controller.rb @@ -29,7 +29,6 @@ module Admin # steal token token = @domain.registrant_verification_token @registrant_verification = RegistrantVerification.new(domain_id: @domain.id, - domain_name: @domain.name, verification_token: token) end diff --git a/app/controllers/admin/pending_updates_controller.rb b/app/controllers/admin/pending_updates_controller.rb index 4a2e5ec7c..72b1ace6e 100644 --- a/app/controllers/admin/pending_updates_controller.rb +++ b/app/controllers/admin/pending_updates_controller.rb @@ -26,7 +26,6 @@ module Admin # steal token token = @domain.registrant_verification_token @registrant_verification = RegistrantVerification.new(domain_id: @domain.id, - domain_name: @domain.name, verification_token: token) end diff --git a/app/controllers/registrant/domain_delete_confirms_controller.rb b/app/controllers/registrant/domain_delete_confirms_controller.rb index 59492fefb..95eefc368 100644 --- a/app/controllers/registrant/domain_delete_confirms_controller.rb +++ b/app/controllers/registrant/domain_delete_confirms_controller.rb @@ -16,7 +16,6 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController end @registrant_verification = RegistrantVerification.new(domain_id: @domain.id, - domain_name: @domain.name, verification_token: params[:token]) initiator = current_registrant_user ? current_registrant_user.username : diff --git a/app/controllers/registrant/domain_update_confirms_controller.rb b/app/controllers/registrant/domain_update_confirms_controller.rb index d0bc1e7a1..61e623ddf 100644 --- a/app/controllers/registrant/domain_update_confirms_controller.rb +++ b/app/controllers/registrant/domain_update_confirms_controller.rb @@ -16,7 +16,6 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController end @registrant_verification = RegistrantVerification.new(domain_id: @domain.id, - domain_name: @domain.name, verification_token: params[:token]) initiator = current_registrant_user ? current_registrant_user.username : diff --git a/app/models/registrant_verification.rb b/app/models/registrant_verification.rb index 952197cf5..e6b68d955 100644 --- a/app/models/registrant_verification.rb +++ b/app/models/registrant_verification.rb @@ -11,7 +11,7 @@ class RegistrantVerification < ApplicationRecord belongs_to :domain - validates :verification_token, :domain_name, :domain, :action, :action_type, presence: true + validates :verification_token, :domain, :action, :action_type, presence: true def domain_registrant_change_confirm!(initiator) self.action_type = DOMAIN_REGISTRANT_CHANGE diff --git a/db/migrate/20191206183853_remove_registrant_verifications_domain_name.rb b/db/migrate/20191206183853_remove_registrant_verifications_domain_name.rb new file mode 100644 index 000000000..0212c60ea --- /dev/null +++ b/db/migrate/20191206183853_remove_registrant_verifications_domain_name.rb @@ -0,0 +1,5 @@ +class RemoveRegistrantVerificationsDomainName < ActiveRecord::Migration[5.0] + def change + remove_column :registrant_verifications, :domain_name + end +end diff --git a/db/structure.sql b/db/structure.sql index 32ec2eb15..8cbf17850 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1963,7 +1963,6 @@ ALTER SEQUENCE public.que_jobs_job_id_seq OWNED BY public.que_jobs.job_id; CREATE TABLE public.registrant_verifications ( id integer NOT NULL, - domain_name character varying NOT NULL, verification_token character varying NOT NULL, created_at timestamp without time zone, updated_at timestamp without time zone, @@ -4361,6 +4360,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20191007123000'), ('20191008024334'), ('20191024153351'), -('20191024160038'); +('20191024160038'), +('20191206183853');