Change primary key of DelegationSignerData and add its history table (#841)

* Change primary key of DelegationSignerData and add its history table

* Change primary key and resolve comments

* Rebase on HEAD
This commit is contained in:
Shicong Huang 2020-10-29 16:19:15 -04:00 committed by GitHub
parent 2000ea2d60
commit b8d913ef64
14 changed files with 4405 additions and 3505 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -66,3 +66,4 @@ V65__local_date_date_type.sql
V66__create_rde_revision.sql
V67__grace_period_history_ids.sql
V68__make_reserved_list_nullable_in_registry.sql
V69__change_primary_key_and_add_history_table_for_delegation_signer.sql

View file

@ -0,0 +1,35 @@
-- 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 "DelegationSignerData" drop constraint "DelegationSignerData_pkey";
alter table "DelegationSignerData"
add constraint "DelegationSignerData_pkey"
primary key (domain_repo_id, key_tag, algorithm, digest_type, digest);
create table "DomainDsDataHistory" (
ds_data_history_revision_id int8 not null,
algorithm int4 not null,
digest bytea not null,
digest_type int4 not null,
domain_history_revision_id int8 not null,
key_tag int4 not null,
domain_repo_id text,
primary key (ds_data_history_revision_id)
);
alter table if exists "DomainDsDataHistory"
add constraint FKo4ilgyyfnvppbpuivus565i0j
foreign key (domain_repo_id, domain_history_revision_id)
references "DomainHistory";

View file

@ -227,12 +227,12 @@
);
create table "DelegationSignerData" (
domain_repo_id text not null,
key_tag int4 not null,
algorithm int4 not null,
algorithm int4 not null,
digest bytea not null,
digest_type int4 not null,
primary key (domain_repo_id, key_tag)
domain_repo_id text not null,
key_tag int4 not null,
primary key (algorithm, digest, digest_type, domain_repo_id, key_tag)
);
create table "Domain" (
@ -291,6 +291,17 @@
primary key (repo_id)
);
create table "DomainDsDataHistory" (
ds_data_history_revision_id int8 not null,
algorithm int4 not null,
digest bytea not null,
digest_type int4 not null,
domain_history_revision_id int8 not null,
domain_repo_id text,
key_tag int4 not null,
primary key (ds_data_history_revision_id)
);
create table "DomainHistory" (
domain_repo_id text not null,
history_revision_id int8 not null,
@ -729,6 +740,11 @@ create index spec11threatmatch_check_date_idx on "Spec11ThreatMatch" (check_date
foreign key (domain_repo_id)
references "Domain";
alter table if exists "DomainDsDataHistory"
add constraint FKo4ilgyyfnvppbpuivus565i0j
foreign key (domain_repo_id, domain_history_revision_id)
references "DomainHistory";
alter table if exists "DomainHistoryHost"
add constraint FKa9woh3hu8gx5x0vly6bai327n
foreign key (domain_history_domain_repo_id, domain_history_history_revision_id)

View file

@ -376,6 +376,21 @@ CREATE TABLE public."Domain" (
);
--
-- Name: DomainDsDataHistory; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."DomainDsDataHistory" (
ds_data_history_revision_id bigint NOT NULL,
algorithm integer NOT NULL,
digest bytea NOT NULL,
digest_type integer NOT NULL,
domain_history_revision_id bigint NOT NULL,
key_tag integer NOT NULL,
domain_repo_id text
);
--
-- Name: DomainHistory; Type: TABLE; Schema: public; Owner: -
--
@ -1072,7 +1087,15 @@ ALTER TABLE ONLY public."Cursor"
--
ALTER TABLE ONLY public."DelegationSignerData"
ADD CONSTRAINT "DelegationSignerData_pkey" PRIMARY KEY (domain_repo_id, key_tag);
ADD CONSTRAINT "DelegationSignerData_pkey" PRIMARY KEY (domain_repo_id, key_tag, algorithm, digest_type, digest);
--
-- Name: DomainDsDataHistory DomainDsDataHistory_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."DomainDsDataHistory"
ADD CONSTRAINT "DomainDsDataHistory_pkey" PRIMARY KEY (ds_data_history_revision_id);
--
@ -2016,6 +2039,14 @@ ALTER TABLE ONLY public."PremiumEntry"
ADD CONSTRAINT fko0gw90lpo1tuee56l0nb6y6g5 FOREIGN KEY (revision_id) REFERENCES public."PremiumList"(revision_id);
--
-- Name: DomainDsDataHistory fko4ilgyyfnvppbpuivus565i0j; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."DomainDsDataHistory"
ADD CONSTRAINT fko4ilgyyfnvppbpuivus565i0j FOREIGN KEY (domain_repo_id, domain_history_revision_id) REFERENCES public."DomainHistory"(domain_repo_id, history_revision_id);
--
-- Name: DelegationSignerData fktr24j9v14ph2mfuw2gsmt12kq; Type: FK CONSTRAINT; Schema: public; Owner: -
--