Add columns for TransferData in Domain and Contact (#577)

* Add columns for TransferData in Domain and Contact

* Rename flyway file and foreign key

* Rebase on master and address comment

* Compileable commit

* Fix unit test

* Refactor TransferServerApproveEntity

* Use tm().delete(vkeys)

* Rename transfer_period fields

* Rename client_id to registrar_id

* Rebase on master

* Resolve comment

* Rebase on master
This commit is contained in:
Shicong Huang 2020-06-09 16:39:55 -04:00 committed by GitHub
parent c154df9d2c
commit fbe613c209
33 changed files with 568 additions and 182 deletions

View file

@ -0,0 +1,84 @@
-- Copyright 2020 The Nomulus Authors. All Rights Reserved.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
alter table "Contact"
add column transfer_gaining_poll_message_id int8,
add column transfer_losing_poll_message_id int8,
add column transfer_billing_cancellation_id int8,
add column transfer_billing_event_id int8,
add column transfer_billing_recurrence_id int8,
add column transfer_autorenew_poll_message_id int8,
add column transfer_renew_period_unit text,
add column transfer_renew_period_value int4,
add column transfer_client_txn_id text,
add column transfer_server_txn_id text,
add column transfer_registration_expiration_time timestamptz,
add column transfer_gaining_registrar_id text,
add column transfer_losing_registrar_id text,
add column transfer_pending_expiration_time timestamptz,
add column transfer_request_time timestamptz,
add column transfer_status text;
alter table "Domain"
add column transfer_gaining_poll_message_id int8,
add column transfer_losing_poll_message_id int8,
add column transfer_billing_cancellation_id int8,
add column transfer_billing_event_id int8,
add column transfer_billing_recurrence_id int8,
add column transfer_autorenew_poll_message_id int8,
add column transfer_renew_period_unit text,
add column transfer_renew_period_value int4,
add column transfer_client_txn_id text,
add column transfer_server_txn_id text,
add column transfer_registration_expiration_time timestamptz,
add column transfer_gaining_registrar_id text,
add column transfer_losing_registrar_id text,
add column transfer_pending_expiration_time timestamptz,
add column transfer_request_time timestamptz,
add column transfer_status text;
alter table if exists "Contact"
add constraint fk_contact_transfer_gaining_registrar_id
foreign key (transfer_gaining_registrar_id)
references "Registrar";
alter table if exists "Contact"
add constraint fk_contact_transfer_losing_registrar_id
foreign key (transfer_losing_registrar_id)
references "Registrar";
alter table if exists "Domain"
add constraint fk_domain_transfer_gaining_registrar_id
foreign key (transfer_gaining_registrar_id)
references "Registrar";
alter table if exists "Domain"
add constraint fk_domain_transfer_losing_registrar_id
foreign key (transfer_losing_registrar_id)
references "Registrar";
alter table if exists "Domain"
add constraint fk_domain_transfer_billing_cancellation_id
foreign key (transfer_billing_cancellation_id)
references "BillingCancellation";
alter table if exists "Domain"
add constraint fk_domain_transfer_billing_event_id
foreign key (transfer_billing_event_id)
references "BillingEvent";
alter table if exists "Domain"
add constraint fk_domain_transfer_billing_recurrence_id
foreign key (transfer_billing_recurrence_id)
references "BillingRecurrence";

View file

@ -118,6 +118,22 @@
addr_local_org text,
addr_local_type text,
search_name text,
transfer_billing_cancellation_id int8,
transfer_gaining_poll_message_id int8,
transfer_losing_poll_message_id int8,
transfer_billing_recurrence_id int8,
transfer_autorenew_poll_message_id int8,
transfer_billing_event_id int8,
transfer_renew_period_unit text,
transfer_renew_period_value int4,
transfer_client_txn_id text,
transfer_server_txn_id text,
transfer_registration_expiration_time timestamptz,
transfer_gaining_registrar_id text,
transfer_losing_registrar_id text,
transfer_pending_expiration_time timestamptz,
transfer_request_time timestamptz,
transfer_status text,
voice_phone_extension text,
voice_phone_number text,
primary key (repo_id)
@ -165,6 +181,22 @@
subordinate_hosts text[],
tech_contact text,
tld text,
transfer_billing_cancellation_id int8,
transfer_gaining_poll_message_id int8,
transfer_losing_poll_message_id int8,
transfer_billing_recurrence_id int8,
transfer_autorenew_poll_message_id int8,
transfer_billing_event_id int8,
transfer_renew_period_unit text,
transfer_renew_period_value int4,
transfer_client_txn_id text,
transfer_server_txn_id text,
transfer_registration_expiration_time timestamptz,
transfer_gaining_registrar_id text,
transfer_losing_registrar_id text,
transfer_pending_expiration_time timestamptz,
transfer_request_time timestamptz,
transfer_status text,
primary key (repo_id)
);

View file

@ -241,7 +241,23 @@ CREATE TABLE public."Contact" (
addr_local_type text,
search_name text,
voice_phone_extension text,
voice_phone_number text
voice_phone_number text,
transfer_gaining_poll_message_id bigint,
transfer_losing_poll_message_id bigint,
transfer_billing_cancellation_id bigint,
transfer_billing_event_id bigint,
transfer_billing_recurrence_id bigint,
transfer_autorenew_poll_message_id bigint,
transfer_renew_period_unit text,
transfer_renew_period_value integer,
transfer_client_txn_id text,
transfer_server_txn_id text,
transfer_registration_expiration_time timestamp with time zone,
transfer_gaining_registrar_id text,
transfer_losing_registrar_id text,
transfer_pending_expiration_time timestamp with time zone,
transfer_request_time timestamp with time zone,
transfer_status text
);
@ -286,7 +302,23 @@ CREATE TABLE public."Domain" (
admin_contact text,
billing_contact text,
registrant_contact text,
tech_contact text
tech_contact text,
transfer_gaining_poll_message_id bigint,
transfer_losing_poll_message_id bigint,
transfer_billing_cancellation_id bigint,
transfer_billing_event_id bigint,
transfer_billing_recurrence_id bigint,
transfer_autorenew_poll_message_id bigint,
transfer_renew_period_unit text,
transfer_renew_period_value integer,
transfer_client_txn_id text,
transfer_server_txn_id text,
transfer_registration_expiration_time timestamp with time zone,
transfer_gaining_registrar_id text,
transfer_losing_registrar_id text,
transfer_pending_expiration_time timestamp with time zone,
transfer_request_time timestamp with time zone,
transfer_status text
);
@ -1127,6 +1159,22 @@ ALTER TABLE ONLY public."BillingRecurrence"
ADD CONSTRAINT fk_billing_recurrence_client_id FOREIGN KEY (client_id) REFERENCES public."Registrar"(client_id);
--
-- Name: Contact fk_contact_transfer_gaining_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Contact"
ADD CONSTRAINT fk_contact_transfer_gaining_registrar_id FOREIGN KEY (transfer_gaining_registrar_id) REFERENCES public."Registrar"(client_id);
--
-- Name: Contact fk_contact_transfer_losing_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Contact"
ADD CONSTRAINT fk_contact_transfer_losing_registrar_id FOREIGN KEY (transfer_losing_registrar_id) REFERENCES public."Registrar"(client_id);
--
-- Name: Domain fk_domain_admin_contact; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@ -1159,6 +1207,46 @@ ALTER TABLE ONLY public."Domain"
ADD CONSTRAINT fk_domain_tech_contact FOREIGN KEY (tech_contact) REFERENCES public."Contact"(repo_id);
--
-- Name: Domain fk_domain_transfer_billing_cancellation_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Domain"
ADD CONSTRAINT fk_domain_transfer_billing_cancellation_id FOREIGN KEY (transfer_billing_cancellation_id) REFERENCES public."BillingCancellation"(billing_cancellation_id);
--
-- Name: Domain fk_domain_transfer_billing_event_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Domain"
ADD CONSTRAINT fk_domain_transfer_billing_event_id FOREIGN KEY (transfer_billing_event_id) REFERENCES public."BillingEvent"(billing_event_id);
--
-- Name: Domain fk_domain_transfer_billing_recurrence_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Domain"
ADD CONSTRAINT fk_domain_transfer_billing_recurrence_id FOREIGN KEY (transfer_billing_recurrence_id) REFERENCES public."BillingRecurrence"(billing_recurrence_id);
--
-- Name: Domain fk_domain_transfer_gaining_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Domain"
ADD CONSTRAINT fk_domain_transfer_gaining_registrar_id FOREIGN KEY (transfer_gaining_registrar_id) REFERENCES public."Registrar"(client_id);
--
-- Name: Domain fk_domain_transfer_losing_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Domain"
ADD CONSTRAINT fk_domain_transfer_losing_registrar_id FOREIGN KEY (transfer_losing_registrar_id) REFERENCES public."Registrar"(client_id);
--
-- Name: DomainHost fk_domainhost_host_valid; Type: FK CONSTRAINT; Schema: public; Owner: -
--