Allow explicitly for null EPP resources in History objects (#790)

* Allow explicitly for null EPP resources in History objects

* Repo IDs should always be nonnull

* Add a test to verify loading / comparison of legacy HistoryEntry objects

* Format javadoc + annotations

* More javadoc changes

* V52 -> V56

* V56 -> V57

* saveNew -> insert in new tests
This commit is contained in:
gbrodman 2020-09-21 15:50:15 -04:00 committed by GitHub
parent f94a3b524c
commit 2fdd71dce5
14 changed files with 503 additions and 100 deletions

View file

@ -0,0 +1,31 @@
-- 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.
-- Note: we drop the not-null constraints from the history tables but we keep them in the
-- EPP resource tables since nothing inserted there should be null
ALTER TABLE "ContactHistory" ALTER COLUMN creation_registrar_id DROP NOT NULL;
ALTER TABLE "ContactHistory" ALTER COLUMN creation_time DROP NOT NULL;
ALTER TABLE "ContactHistory" ALTER COLUMN current_sponsor_registrar_id DROP NOT NULL;
ALTER TABLE "ContactHistory" ALTER COLUMN history_reason DROP NOT NULL;
ALTER TABLE "DomainHistory" ALTER COLUMN creation_registrar_id DROP NOT NULL;
ALTER TABLE "DomainHistory" ALTER COLUMN creation_time DROP NOT NULL;
ALTER TABLE "DomainHistory" ALTER COLUMN current_sponsor_registrar_id DROP NOT NULL;
ALTER TABLE "DomainHistory" ALTER COLUMN history_reason DROP NOT NULL;
ALTER TABLE "HostHistory" ALTER COLUMN creation_registrar_id DROP NOT NULL;
ALTER TABLE "HostHistory" ALTER COLUMN creation_time DROP NOT NULL;
ALTER TABLE "HostHistory" ALTER COLUMN current_sponsor_registrar_id DROP NOT NULL;
ALTER TABLE "HostHistory" ALTER COLUMN history_reason DROP NOT NULL;

View file

@ -94,9 +94,9 @@ create sequence temp_history_id_sequence start 1 increment 50;
create table "Contact" (
repo_id text not null,
update_timestamp timestamptz,
creation_registrar_id text not null,
creation_time timestamptz not null,
current_sponsor_registrar_id text not null,
creation_registrar_id text,
creation_time timestamptz,
current_sponsor_registrar_id text,
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,
@ -155,7 +155,7 @@ create sequence temp_history_id_sequence start 1 increment 50;
history_by_superuser boolean not null,
history_registrar_id text,
history_modification_time timestamptz not null,
history_reason text not null,
history_reason text,
history_requested_by_registrar boolean not null,
history_client_transaction_id text,
history_server_transaction_id text,
@ -207,9 +207,9 @@ create sequence temp_history_id_sequence start 1 increment 50;
transfer_status text,
voice_phone_extension text,
voice_phone_number text,
creation_registrar_id text not null,
creation_time timestamptz not null,
current_sponsor_registrar_id text not null,
creation_registrar_id text,
creation_time timestamptz,
current_sponsor_registrar_id text,
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,
@ -238,9 +238,9 @@ create sequence temp_history_id_sequence start 1 increment 50;
create table "Domain" (
repo_id text not null,
update_timestamp timestamptz,
creation_registrar_id text not null,
creation_time timestamptz not null,
current_sponsor_registrar_id text not null,
creation_registrar_id text,
creation_time timestamptz,
current_sponsor_registrar_id text,
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,
@ -291,7 +291,7 @@ create sequence temp_history_id_sequence start 1 increment 50;
history_by_superuser boolean not null,
history_registrar_id text,
history_modification_time timestamptz not null,
history_reason text not null,
history_reason text,
history_requested_by_registrar boolean not null,
history_client_transaction_id text,
history_server_transaction_id text,
@ -334,9 +334,9 @@ create sequence temp_history_id_sequence start 1 increment 50;
transfer_pending_expiration_time timestamptz,
transfer_request_time timestamptz,
transfer_status text,
creation_registrar_id text not null,
creation_time timestamptz not null,
current_sponsor_registrar_id text not null,
creation_registrar_id text,
creation_time timestamptz,
current_sponsor_registrar_id text,
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,
@ -384,9 +384,9 @@ create sequence temp_history_id_sequence start 1 increment 50;
create table "Host" (
repo_id text not null,
update_timestamp timestamptz,
creation_registrar_id text not null,
creation_time timestamptz not null,
current_sponsor_registrar_id text not null,
creation_registrar_id text,
creation_time timestamptz,
current_sponsor_registrar_id text,
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,
@ -404,7 +404,7 @@ create sequence temp_history_id_sequence start 1 increment 50;
history_by_superuser boolean not null,
history_registrar_id text,
history_modification_time timestamptz not null,
history_reason text not null,
history_reason text,
history_requested_by_registrar boolean not null,
history_client_transaction_id text,
history_server_transaction_id text,
@ -415,9 +415,9 @@ create sequence temp_history_id_sequence start 1 increment 50;
last_superordinate_change timestamptz,
last_transfer_time timestamptz,
superordinate_domain text,
creation_registrar_id text not null,
creation_time timestamptz not null,
current_sponsor_registrar_id text not null,
creation_registrar_id text,
creation_time timestamptz,
current_sponsor_registrar_id text,
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,

View file

@ -284,7 +284,7 @@ CREATE TABLE public."ContactHistory" (
history_by_superuser boolean NOT NULL,
history_registrar_id text,
history_modification_time timestamp with time zone NOT NULL,
history_reason text NOT NULL,
history_reason text,
history_requested_by_registrar boolean NOT NULL,
history_client_transaction_id text,
history_server_transaction_id text,
@ -336,9 +336,9 @@ CREATE TABLE public."ContactHistory" (
transfer_status text,
voice_phone_extension text,
voice_phone_number text,
creation_registrar_id text NOT NULL,
creation_time timestamp with time zone NOT NULL,
current_sponsor_registrar_id text NOT NULL,
creation_registrar_id text,
creation_time timestamp with time zone,
current_sponsor_registrar_id text,
deletion_time timestamp with time zone,
last_epp_update_registrar_id text,
last_epp_update_time timestamp with time zone,
@ -423,7 +423,7 @@ CREATE TABLE public."DomainHistory" (
history_by_superuser boolean NOT NULL,
history_registrar_id text,
history_modification_time timestamp with time zone NOT NULL,
history_reason text NOT NULL,
history_reason text,
history_requested_by_registrar boolean NOT NULL,
history_client_transaction_id text,
history_server_transaction_id text,
@ -465,9 +465,9 @@ CREATE TABLE public."DomainHistory" (
transfer_pending_expiration_time timestamp with time zone,
transfer_request_time timestamp with time zone,
transfer_status text,
creation_registrar_id text NOT NULL,
creation_time timestamp with time zone NOT NULL,
current_sponsor_registrar_id text NOT NULL,
creation_registrar_id text,
creation_time timestamp with time zone,
current_sponsor_registrar_id text,
deletion_time timestamp with time zone,
last_epp_update_registrar_id text,
last_epp_update_time timestamp with time zone,
@ -601,7 +601,7 @@ CREATE TABLE public."HostHistory" (
history_by_superuser boolean NOT NULL,
history_registrar_id text NOT NULL,
history_modification_time timestamp with time zone NOT NULL,
history_reason text NOT NULL,
history_reason text,
history_requested_by_registrar boolean NOT NULL,
history_client_transaction_id text,
history_server_transaction_id text,
@ -612,9 +612,9 @@ CREATE TABLE public."HostHistory" (
last_superordinate_change timestamp with time zone,
last_transfer_time timestamp with time zone,
superordinate_domain text,
creation_registrar_id text NOT NULL,
creation_time timestamp with time zone NOT NULL,
current_sponsor_registrar_id text NOT NULL,
creation_registrar_id text,
creation_time timestamp with time zone,
current_sponsor_registrar_id text,
deletion_time timestamp with time zone,
last_epp_update_registrar_id text,
last_epp_update_time timestamp with time zone,