mirror of
https://github.com/google/nomulus.git
synced 2025-05-28 11:10:57 +02:00
Add HostBase and HostHistory classes (#587)
* Add proof of concept for HostBase and HostHistory classes * Use a PROPERTY accessor for @Ids * Add an unused setter method for Hibernate's sake * Refactor HostHistory * Some responses to CR * Fix relationship and test * Manually manage the foreign keys for HostHistory * Protect HostBase's builder and use text for the enum type * Add responses to CR - Add javadocs - Create an ID sequence for host history objects * Don't try to set the ID * Use a Long and remove the setter * Add some comments and rename a couple fields * Don't change Datastore schema * Use Long in the Datastore schema * Add new createVKey method * Add comments and rename fields * Rename v27->v31 and regenerate the golden * Fix superordinateDomain and inetAddresses in HostHistory * V31 -> V32 * Fix SQL files that got messed up in the merge * Configure and use a manually-created history ID sequence * Add three more indices to HostHistory
This commit is contained in:
parent
26e2a51180
commit
47178d4fb5
15 changed files with 742 additions and 203 deletions
|
@ -0,0 +1,66 @@
|
|||
-- 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.
|
||||
|
||||
CREATE TABLE "HostHistory" (
|
||||
history_revision_id int8 NOT NULL,
|
||||
history_by_superuser boolean NOT NULL,
|
||||
history_registrar_id text NOT NULL,
|
||||
history_modification_time timestamptz NOT NULL,
|
||||
history_reason text NOT NULL,
|
||||
history_requested_by_registrar boolean NOT NULL,
|
||||
history_client_transaction_id text,
|
||||
history_server_transaction_id text,
|
||||
history_type text NOT NULL,
|
||||
history_xml_bytes bytea NOT NULL,
|
||||
fully_qualified_host_name text,
|
||||
inet_addresses text[],
|
||||
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,
|
||||
deletion_time timestamptz,
|
||||
last_epp_update_registrar_id text,
|
||||
last_epp_update_time timestamptz,
|
||||
statuses text[],
|
||||
host_repo_id text NOT NULL,
|
||||
primary key (history_revision_id)
|
||||
);
|
||||
|
||||
CREATE INDEX IDXfg2nnjlujxo6cb9fha971bq2n ON "HostHistory" (creation_time);
|
||||
CREATE INDEX IDX1iy7njgb7wjmj9piml4l2g0qi ON "HostHistory" (history_registrar_id);
|
||||
CREATE INDEX IDXj77pfwhui9f0i7wjq6lmibovj ON "HostHistory" (fully_qualified_host_name);
|
||||
CREATE INDEX IDXknk8gmj7s47q56cwpa6rmpt5l ON "HostHistory" (history_type);
|
||||
CREATE INDEX IDX67qwkjtlq5q8dv6egtrtnhqi7 ON "HostHistory" (history_modification_time);
|
||||
|
||||
ALTER TABLE IF EXISTS "HostHistory"
|
||||
ADD CONSTRAINT FK3d09knnmxrt6iniwnp8j2ykga
|
||||
FOREIGN KEY (history_registrar_id)
|
||||
REFERENCES "Registrar";
|
||||
|
||||
ALTER TABLE IF EXISTS "HostHistory"
|
||||
ADD CONSTRAINT FK_HostHistory_HostResource
|
||||
FOREIGN KEY (host_repo_id)
|
||||
REFERENCES "HostResource";
|
||||
|
||||
CREATE SEQUENCE public."history_id_sequence"
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
ALTER TABLE ONLY public."HostHistory" ALTER COLUMN history_revision_id
|
||||
SET DEFAULT nextval('public."history_id_sequence"'::regclass);
|
|
@ -11,6 +11,7 @@
|
|||
-- 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.
|
||||
create sequence history_id_sequence start 1 increment 1;
|
||||
|
||||
create table "BillingCancellation" (
|
||||
billing_cancellation_id bigserial not null,
|
||||
|
@ -208,6 +209,33 @@
|
|||
primary key (id)
|
||||
);
|
||||
|
||||
create table "HostHistory" (
|
||||
history_revision_id int8 not null,
|
||||
history_by_superuser boolean not null,
|
||||
history_registrar_id text,
|
||||
history_modification_time timestamptz not null,
|
||||
history_reason text not null,
|
||||
history_requested_by_registrar boolean not null,
|
||||
history_client_transaction_id text,
|
||||
history_server_transaction_id text,
|
||||
history_type text not null,
|
||||
history_xml_bytes bytea not null,
|
||||
fully_qualified_host_name text,
|
||||
inet_addresses text[],
|
||||
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,
|
||||
deletion_time timestamptz,
|
||||
last_epp_update_registrar_id text,
|
||||
last_epp_update_time timestamptz,
|
||||
statuses text[],
|
||||
host_repo_id text not null,
|
||||
primary key (history_revision_id)
|
||||
);
|
||||
|
||||
create table "HostResource" (
|
||||
repo_id text not null,
|
||||
creation_registrar_id text not null,
|
||||
|
@ -403,6 +431,11 @@ create index IDXhsjqiy2lyobfymplb28nm74lm on "Domain" (current_sponsor_registrar
|
|||
create index IDX5mnf0wn20tno4b9do88j61klr on "Domain" (deletion_time);
|
||||
create index IDX1rcgkdd777bpvj0r94sltwd5y on "Domain" (fully_qualified_domain_name);
|
||||
create index IDXrwl38wwkli1j7gkvtywi9jokq on "Domain" (tld);
|
||||
create index IDXfg2nnjlujxo6cb9fha971bq2n on "HostHistory" (creation_time);
|
||||
create index IDX1iy7njgb7wjmj9piml4l2g0qi on "HostHistory" (history_registrar_id);
|
||||
create index IDXj77pfwhui9f0i7wjq6lmibovj on "HostHistory" (fully_qualified_host_name);
|
||||
create index IDXknk8gmj7s47q56cwpa6rmpt5l on "HostHistory" (history_type);
|
||||
create index IDX67qwkjtlq5q8dv6egtrtnhqi7 on "HostHistory" (history_modification_time);
|
||||
create index IDXe7wu46c7wpvfmfnj4565abibp on "PollMessage" (registrar_id);
|
||||
create index IDXaydgox62uno9qx8cjlj5lauye on "PollMessage" (event_time);
|
||||
create index premiumlist_name_idx on "PremiumList" (name);
|
||||
|
|
|
@ -325,6 +325,49 @@ CREATE TABLE public."DomainHost" (
|
|||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: history_id_sequence; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.history_id_sequence
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
--
|
||||
-- Name: HostHistory; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public."HostHistory" (
|
||||
history_revision_id bigint DEFAULT nextval('public.history_id_sequence'::regclass) NOT NULL,
|
||||
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_requested_by_registrar boolean NOT NULL,
|
||||
history_client_transaction_id text,
|
||||
history_server_transaction_id text,
|
||||
history_type text NOT NULL,
|
||||
history_xml_bytes bytea NOT NULL,
|
||||
fully_qualified_host_name text,
|
||||
inet_addresses text[],
|
||||
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,
|
||||
deletion_time timestamp with time zone,
|
||||
last_epp_update_registrar_id text,
|
||||
last_epp_update_time timestamp with time zone,
|
||||
statuses text[],
|
||||
host_repo_id text NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: HostResource; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -733,6 +776,14 @@ ALTER TABLE ONLY public."Domain"
|
|||
ADD CONSTRAINT "Domain_pkey" PRIMARY KEY (repo_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: HostHistory HostHistory_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public."HostHistory"
|
||||
ADD CONSTRAINT "HostHistory_pkey" PRIMARY KEY (history_revision_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: HostResource HostResource_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -829,6 +880,13 @@ ALTER TABLE ONLY public."Contact"
|
|||
ADD CONSTRAINT ukoqd7n4hbx86hvlgkilq75olas UNIQUE (contact_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: idx1iy7njgb7wjmj9piml4l2g0qi; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX idx1iy7njgb7wjmj9piml4l2g0qi ON public."HostHistory" USING btree (history_registrar_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: idx1p3esngcwwu6hstyua6itn6ff; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -871,6 +929,13 @@ CREATE INDEX idx5mnf0wn20tno4b9do88j61klr ON public."Domain" USING btree (deleti
|
|||
CREATE INDEX idx5yfbr88439pxw0v3j86c74fp8 ON public."BillingEvent" USING btree (event_time);
|
||||
|
||||
|
||||
--
|
||||
-- Name: idx67qwkjtlq5q8dv6egtrtnhqi7; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX idx67qwkjtlq5q8dv6egtrtnhqi7 ON public."HostHistory" USING btree (history_modification_time);
|
||||
|
||||
|
||||
--
|
||||
-- Name: idx6py6ocrab0ivr76srcd2okpnq; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -941,6 +1006,13 @@ CREATE INDEX idxe7wu46c7wpvfmfnj4565abibp ON public."PollMessage" USING btree (r
|
|||
CREATE INDEX idxeokttmxtpq2hohcioe5t2242b ON public."BillingCancellation" USING btree (registrar_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: idxfg2nnjlujxo6cb9fha971bq2n; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX idxfg2nnjlujxo6cb9fha971bq2n ON public."HostHistory" USING btree (creation_time);
|
||||
|
||||
|
||||
--
|
||||
-- Name: idxhmv411mdqo5ibn4vy7ykxpmlv; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -948,6 +1020,13 @@ CREATE INDEX idxeokttmxtpq2hohcioe5t2242b ON public."BillingCancellation" USING
|
|||
CREATE INDEX idxhmv411mdqo5ibn4vy7ykxpmlv ON public."BillingEvent" USING btree (allocation_token_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: idxj77pfwhui9f0i7wjq6lmibovj; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX idxj77pfwhui9f0i7wjq6lmibovj ON public."HostHistory" USING btree (fully_qualified_host_name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: idxjny8wuot75b5e6p38r47wdawu; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -962,6 +1041,13 @@ CREATE INDEX idxjny8wuot75b5e6p38r47wdawu ON public."BillingRecurrence" USING bt
|
|||
CREATE INDEX idxkjt9yaq92876dstimd93hwckh ON public."Domain" USING btree (current_sponsor_registrar_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: idxknk8gmj7s47q56cwpa6rmpt5l; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX idxknk8gmj7s47q56cwpa6rmpt5l ON public."HostHistory" USING btree (history_type);
|
||||
|
||||
|
||||
--
|
||||
-- Name: idxn1f711wicdnooa2mqb7g1m55o; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -1071,6 +1157,14 @@ ALTER TABLE ONLY public."Domain"
|
|||
ADD CONSTRAINT fk2u3srsfbei272093m3b3xwj23 FOREIGN KEY (current_sponsor_registrar_id) REFERENCES public."Registrar"(registrar_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: HostHistory fk3d09knnmxrt6iniwnp8j2ykga; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public."HostHistory"
|
||||
ADD CONSTRAINT fk3d09knnmxrt6iniwnp8j2ykga FOREIGN KEY (history_registrar_id) REFERENCES public."Registrar"(registrar_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: ClaimsEntry fk6sc6at5hedffc0nhdcab6ivuq; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -1239,6 +1333,14 @@ ALTER TABLE ONLY public."HostResource"
|
|||
ADD CONSTRAINT fk_host_resource_superordinate_domain FOREIGN KEY (superordinate_domain) REFERENCES public."Domain"(repo_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: HostHistory fk_hosthistory_hostresource; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public."HostHistory"
|
||||
ADD CONSTRAINT fk_hosthistory_hostresource FOREIGN KEY (host_repo_id) REFERENCES public."HostResource"(repo_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: PollMessage fk_poll_message_contact_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue