Generate sql schema for PollMessage (#582)

* Generate sql schema for PollMessage

* Rework columns and resolve comments

* Fix datastore schema
This commit is contained in:
Shicong Huang 2020-06-04 18:24:59 -04:00 committed by GitHub
parent b42ded9451
commit b1241b98b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 424 additions and 16 deletions

View file

@ -0,0 +1,76 @@
-- 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 "PollMessage" (
type text not null,
poll_message_id bigserial not null,
registrar_id text not null,
contact_repo_id text,
contact_revision_id int8,
domain_repo_id text,
domain_revision_id int8,
event_time timestamptz not null,
host_repo_id text,
host_revision_id int8,
message text,
transfer_response_contact_id text,
transfer_response_domain_expiration_time timestamptz,
transfer_response_domain_name text,
pending_action_response_action_result boolean,
pending_action_response_name_or_id text,
pending_action_response_processed_date timestamptz,
pending_action_response_client_txn_id text,
pending_action_response_server_txn_id text,
transfer_response_gaining_registrar_id text,
transfer_response_losing_registrar_id text,
transfer_response_pending_transfer_expiration_time timestamptz,
transfer_response_transfer_request_time timestamptz,
transfer_response_transfer_status text,
autorenew_end_time timestamptz,
autorenew_domain_name text,
primary key (poll_message_id)
);
create index IDXe7wu46c7wpvfmfnj4565abibp on "PollMessage" (registrar_id);
create index IDXaydgox62uno9qx8cjlj5lauye on "PollMessage" (event_time);
alter table if exists "PollMessage"
add constraint fk_poll_message_registrar_id
foreign key (registrar_id)
references "Registrar";
alter table if exists "PollMessage"
add constraint fk_poll_message_contact_repo_id
foreign key (contact_repo_id)
references "Contact";
alter table if exists "PollMessage"
add constraint fk_poll_message_domain_repo_id
foreign key (domain_repo_id)
references "Domain";
alter table if exists "PollMessage"
add constraint fk_poll_message_host_repo_id
foreign key (host_repo_id)
references "HostResource";
alter table if exists "PollMessage"
add constraint fk_poll_message_transfer_response_gaining_registrar_id
foreign key (transfer_response_gaining_registrar_id)
references "Registrar";
alter table if exists "PollMessage"
add constraint fk_poll_message_transfer_response_losing_registrar_id
foreign key (transfer_response_losing_registrar_id)
references "Registrar";

View file

@ -213,6 +213,36 @@
primary key (resource_name, tld)
);
create table "PollMessage" (
type text not null,
poll_message_id bigserial not null,
registrar_id text not null,
contact_repo_id text,
contact_revision_id int8,
domain_repo_id text,
domain_revision_id int8,
event_time timestamptz not null,
host_repo_id text,
host_revision_id int8,
message text,
transfer_response_contact_id text,
transfer_response_domain_expiration_time timestamptz,
transfer_response_domain_name text,
pending_action_response_action_result boolean,
pending_action_response_name_or_id text,
pending_action_response_processed_date timestamptz,
pending_action_response_client_txn_id text,
pending_action_response_server_txn_id text,
transfer_response_gaining_registrar_id text,
transfer_response_losing_registrar_id text,
transfer_response_pending_transfer_expiration_time timestamptz,
transfer_response_transfer_request_time timestamptz,
transfer_response_transfer_status text,
autorenew_end_time timestamptz,
autorenew_domain_name text,
primary key (poll_message_id)
);
create table "PremiumEntry" (
revision_id int8 not null,
domain_label text not null,
@ -352,6 +382,8 @@ create index IDX8ffrqm27qtj20jac056j7yq07 on "Domain" (current_sponsor_client_id
create index IDX5mnf0wn20tno4b9do88j61klr on "Domain" (deletion_time);
create index IDX1rcgkdd777bpvj0r94sltwd5y on "Domain" (fully_qualified_domain_name);
create index IDXrwl38wwkli1j7gkvtywi9jokq on "Domain" (tld);
create index IDXe7wu46c7wpvfmfnj4565abibp on "PollMessage" (registrar_id);
create index IDXaydgox62uno9qx8cjlj5lauye on "PollMessage" (event_time);
create index premiumlist_name_idx on "PremiumList" (name);
create index registrar_name_idx on "Registrar" (registrar_name);
create index registrar_iana_identifier_idx on "Registrar" (iana_identifier);

View file

@ -343,6 +343,59 @@ CREATE TABLE public."Lock" (
);
--
-- Name: PollMessage; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."PollMessage" (
type text NOT NULL,
poll_message_id bigint NOT NULL,
registrar_id text NOT NULL,
contact_repo_id text,
contact_revision_id bigint,
domain_repo_id text,
domain_revision_id bigint,
event_time timestamp with time zone NOT NULL,
host_repo_id text,
host_revision_id bigint,
message text,
transfer_response_contact_id text,
transfer_response_domain_expiration_time timestamp with time zone,
transfer_response_domain_name text,
pending_action_response_action_result boolean,
pending_action_response_name_or_id text,
pending_action_response_processed_date timestamp with time zone,
pending_action_response_client_txn_id text,
pending_action_response_server_txn_id text,
transfer_response_gaining_registrar_id text,
transfer_response_losing_registrar_id text,
transfer_response_pending_transfer_expiration_time timestamp with time zone,
transfer_response_transfer_request_time timestamp with time zone,
transfer_response_transfer_status text,
autorenew_end_time timestamp with time zone,
autorenew_domain_name text
);
--
-- Name: PollMessage_poll_message_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."PollMessage_poll_message_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: PollMessage_poll_message_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."PollMessage_poll_message_id_seq" OWNED BY public."PollMessage".poll_message_id;
--
-- Name: PremiumEntry; Type: TABLE; Schema: public; Owner: -
--
@ -572,6 +625,13 @@ ALTER TABLE ONLY public."BillingRecurrence" ALTER COLUMN billing_recurrence_id S
ALTER TABLE ONLY public."ClaimsList" ALTER COLUMN revision_id SET DEFAULT nextval('public."ClaimsList_revision_id_seq"'::regclass);
--
-- Name: PollMessage poll_message_id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage" ALTER COLUMN poll_message_id SET DEFAULT nextval('public."PollMessage_poll_message_id_seq"'::regclass);
--
-- Name: PremiumList revision_id; Type: DEFAULT; Schema: public; Owner: -
--
@ -673,6 +733,14 @@ ALTER TABLE ONLY public."Lock"
ADD CONSTRAINT "Lock_pkey" PRIMARY KEY (resource_name, tld);
--
-- Name: PollMessage PollMessage_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT "PollMessage_pkey" PRIMARY KEY (poll_message_id);
--
-- Name: PremiumEntry PremiumEntry_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
@ -829,6 +897,13 @@ CREATE INDEX idx_registry_lock_registrar_id ON public."RegistryLock" USING btree
CREATE INDEX idx_registry_lock_verification_code ON public."RegistryLock" USING btree (verification_code);
--
-- Name: idxaydgox62uno9qx8cjlj5lauye; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idxaydgox62uno9qx8cjlj5lauye ON public."PollMessage" USING btree (event_time);
--
-- Name: idxbn8t4wp85fgxjl8q4ctlscx55; Type: INDEX; Schema: public; Owner: -
--
@ -836,6 +911,13 @@ CREATE INDEX idx_registry_lock_verification_code ON public."RegistryLock" USING
CREATE INDEX idxbn8t4wp85fgxjl8q4ctlscx55 ON public."Contact" USING btree (current_sponsor_client_id);
--
-- Name: idxe7wu46c7wpvfmfnj4565abibp; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idxe7wu46c7wpvfmfnj4565abibp ON public."PollMessage" USING btree (registrar_id);
--
-- Name: idxeokttmxtpq2hohcioe5t2242b; Type: INDEX; Schema: public; Owner: -
--
@ -1085,6 +1167,54 @@ ALTER TABLE ONLY public."DomainHost"
ADD CONSTRAINT fk_domainhost_host_valid FOREIGN KEY (ns_hosts) REFERENCES public."HostResource"(repo_id);
--
-- Name: PollMessage fk_poll_message_contact_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_contact_repo_id FOREIGN KEY (contact_repo_id) REFERENCES public."Contact"(repo_id);
--
-- Name: PollMessage fk_poll_message_domain_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_domain_repo_id FOREIGN KEY (domain_repo_id) REFERENCES public."Domain"(repo_id);
--
-- Name: PollMessage fk_poll_message_host_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_host_repo_id FOREIGN KEY (host_repo_id) REFERENCES public."HostResource"(repo_id);
--
-- Name: PollMessage fk_poll_message_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_registrar_id FOREIGN KEY (registrar_id) REFERENCES public."Registrar"(client_id);
--
-- Name: PollMessage fk_poll_message_transfer_response_gaining_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_transfer_response_gaining_registrar_id FOREIGN KEY (transfer_response_gaining_registrar_id) REFERENCES public."Registrar"(client_id);
--
-- Name: PollMessage fk_poll_message_transfer_response_losing_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_transfer_response_losing_registrar_id FOREIGN KEY (transfer_response_losing_registrar_id) REFERENCES public."Registrar"(client_id);
--
-- Name: DomainHost fkfmi7bdink53swivs390m2btxg; Type: FK CONSTRAINT; Schema: public; Owner: -
--