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 1e51f51979
commit 5bba65835a
14 changed files with 4405 additions and 3505 deletions
@@ -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)
@@ -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: -
--