google-nomulus/db/src/main/resources/sql/flyway/V92__singletons.sql
gbrodman c81cbcc1bb Convert TmchCrl and ServerSecret to cleaner tm() impls (#1068)
* Convert TmchCrl and ServerSecret to cleaner tm() impls

When I implemented this originally I knew a lot less than I know now
about how we'll be storing and retrieving these singletons from SQL. The
optimal way here is to use the single SINGLETON_ID as the primary key,
that way we always know how to create the key that we can use in the
tm() retrieval.

This allows us to use generic tm() methods and to remove the handcrafted
SQL queries.
2021-04-13 20:50:07 -04:00

21 lines
940 B
SQL

-- Copyright 2021 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 "ServerSecret" DROP CONSTRAINT "ServerSecret_pkey";
ALTER TABLE "ServerSecret" ADD COLUMN id bigint NOT NULL;
ALTER TABLE "ServerSecret" ADD PRIMARY KEY(id);
ALTER TABLE "TmchCrl" DROP CONSTRAINT "TmchCrl_pkey";
ALTER TABLE "TmchCrl" ADD COLUMN id bigint NOT NULL;
ALTER TABLE "TmchCrl" ADD PRIMARY KEY(id);