Persist two singleton entities in SQL tables (#860)

* Persist two singleton entities in SQL tables

A table might not be the best place to store singleton entities, but by
doing this we ensure we can easily inspect them later and use the same
sort of persistence logic for these that we do elsewhere.

ServerSecret is stored upon retrieval so that we make sure that the same
secret is used in both Datastore and SQL (we wouldn't want to change
it).

* Responses to CR

* Don't have a separate ID for the singleton entities

* Rename secret UUID

* Rename and regenerate
This commit is contained in:
gbrodman 2020-11-09 13:47:42 -05:00 committed by GitHub
parent 8a1f5102ce
commit 9acac1a6a4
15 changed files with 759 additions and 215 deletions

View file

@ -899,6 +899,15 @@ CREATE SEQUENCE public."SafeBrowsingThreat_id_seq"
ALTER SEQUENCE public."SafeBrowsingThreat_id_seq" OWNED BY public."Spec11ThreatMatch".id;
--
-- Name: ServerSecret; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."ServerSecret" (
secret uuid NOT NULL
);
--
-- Name: SignedMarkRevocationEntry; Type: TABLE; Schema: public; Owner: -
--
@ -985,6 +994,17 @@ CREATE TABLE public."Tld" (
);
--
-- Name: TmchCrl; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."TmchCrl" (
certificate_revocations text NOT NULL,
update_timestamp timestamp with time zone NOT NULL,
url text NOT NULL
);
--
-- Name: Transaction; Type: TABLE; Schema: public; Owner: -
--
@ -1302,6 +1322,14 @@ ALTER TABLE ONLY public."Spec11ThreatMatch"
ADD CONSTRAINT "SafeBrowsingThreat_pkey" PRIMARY KEY (id);
--
-- Name: ServerSecret ServerSecret_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."ServerSecret"
ADD CONSTRAINT "ServerSecret_pkey" PRIMARY KEY (secret);
--
-- Name: SignedMarkRevocationEntry SignedMarkRevocationEntry_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
@ -1326,6 +1354,14 @@ ALTER TABLE ONLY public."Tld"
ADD CONSTRAINT "Tld_pkey" PRIMARY KEY (tld_name);
--
-- Name: TmchCrl TmchCrl_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."TmchCrl"
ADD CONSTRAINT "TmchCrl_pkey" PRIMARY KEY (certificate_revocations, update_timestamp, url);
--
-- Name: Transaction Transaction_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--