Rename HostResource table to Host (#804)

* Rename HostResource table to Host

* Convert drop/creates to renames
This commit is contained in:
Michael Muller 2020-09-21 11:43:25 -04:00 committed by GitHub
parent 8bd5df98ff
commit f905e67494
4 changed files with 72 additions and 51 deletions

View file

@ -32,7 +32,7 @@ import javax.persistence.AccessType;
*/
@ReportedOn
@Entity
@javax.persistence.Entity
@javax.persistence.Entity(name = "Host")
@ExternalMessagingName("host")
@WithStringVKey
@Access(AccessType.FIELD) // otherwise it'll use the default if the repoId (property)

View file

@ -0,0 +1,21 @@
-- 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 "HostResource" RENAME TO "Host";
ALTER TABLE "HostHistory" RENAME CONSTRAINT fk_hosthistory_hostresource TO fk_hosthistory_host;
ALTER TABLE "Host"
RENAME CONSTRAINT fk_host_resource_superordinate_domain TO fk_host_superordinate_domain;
ALTER TABLE "Host" RENAME CONSTRAINT "HostResource_pkey" TO "Host_pkey";

View file

@ -381,6 +381,24 @@ create sequence temp_history_id_sequence start 1 increment 50;
primary key (id)
);
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,
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,
statuses text[],
host_name text,
inet_addresses text[],
last_superordinate_change timestamptz,
last_transfer_time timestamptz,
superordinate_domain text,
primary key (repo_id)
);
create table "HostHistory" (
history_revision_id int8 not null,
history_by_superuser boolean not null,
@ -409,24 +427,6 @@ create sequence temp_history_id_sequence start 1 increment 50;
primary key (history_revision_id)
);
create table "HostResource" (
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,
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,
statuses text[],
host_name text,
inet_addresses text[],
last_superordinate_change timestamptz,
last_transfer_time timestamptz,
superordinate_domain text,
primary key (repo_id)
);
create table "Lock" (
resource_name text not null,
tld text not null,

View file

@ -570,6 +570,28 @@ CREATE SEQUENCE public."GracePeriod_id_seq"
ALTER SEQUENCE public."GracePeriod_id_seq" OWNED BY public."GracePeriod".id;
--
-- Name: Host; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."Host" (
repo_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,
statuses text[],
host_name text,
last_superordinate_change timestamp with time zone,
last_transfer_time timestamp with time zone,
superordinate_domain text,
inet_addresses text[],
update_timestamp timestamp with time zone
);
--
-- Name: HostHistory; Type: TABLE; Schema: public; Owner: -
--
@ -602,28 +624,6 @@ CREATE TABLE public."HostHistory" (
);
--
-- Name: HostResource; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."HostResource" (
repo_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,
statuses text[],
host_name text,
last_superordinate_change timestamp with time zone,
last_transfer_time timestamp with time zone,
superordinate_domain text,
inet_addresses text[],
update_timestamp timestamp with time zone
);
--
-- Name: Lock; Type: TABLE; Schema: public; Owner: -
--
@ -1222,11 +1222,11 @@ ALTER TABLE ONLY public."HostHistory"
--
-- Name: HostResource HostResource_pkey; Type: CONSTRAINT; Schema: public; Owner: -
-- Name: Host Host_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."HostResource"
ADD CONSTRAINT "HostResource_pkey" PRIMARY KEY (repo_id);
ALTER TABLE ONLY public."Host"
ADD CONSTRAINT "Host_pkey" PRIMARY KEY (repo_id);
--
@ -1944,7 +1944,7 @@ ALTER TABLE ONLY public."Domain"
--
ALTER TABLE ONLY public."DomainHost"
ADD CONSTRAINT fk_domainhost_host_valid FOREIGN KEY (host_repo_id) REFERENCES public."HostResource"(repo_id);
ADD CONSTRAINT fk_domainhost_host_valid FOREIGN KEY (host_repo_id) REFERENCES public."Host"(repo_id);
--
@ -1964,19 +1964,19 @@ ALTER TABLE ONLY public."GracePeriod"
--
-- Name: HostResource fk_host_resource_superordinate_domain; Type: FK CONSTRAINT; Schema: public; Owner: -
-- Name: Host fk_host_superordinate_domain; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."HostResource"
ADD CONSTRAINT fk_host_resource_superordinate_domain FOREIGN KEY (superordinate_domain) REFERENCES public."Domain"(repo_id);
ALTER TABLE ONLY public."Host"
ADD CONSTRAINT fk_host_superordinate_domain FOREIGN KEY (superordinate_domain) REFERENCES public."Domain"(repo_id);
--
-- Name: HostHistory fk_hosthistory_hostresource; Type: FK CONSTRAINT; Schema: public; Owner: -
-- Name: HostHistory fk_hosthistory_host; 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);
ADD CONSTRAINT fk_hosthistory_host FOREIGN KEY (host_repo_id) REFERENCES public."Host"(repo_id);
--
@ -2000,7 +2000,7 @@ ALTER TABLE ONLY public."PollMessage"
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_host_repo_id FOREIGN KEY (host_repo_id) REFERENCES public."HostResource"(repo_id);
ADD CONSTRAINT fk_poll_message_host_repo_id FOREIGN KEY (host_repo_id) REFERENCES public."Host"(repo_id);
--