mirror of
https://github.com/google/nomulus.git
synced 2025-06-22 12:20:46 +02:00
Add initial support for persisting premium lists to Cloud SQL (#285)
* Add initial support for persisting premium lists to Cloud SQL This adds support to the `nomulus create_premium_list` command only; support for `nomulus update_premium_list` will be in a subsequent PR. The design goals for this PR were: 1. Do not change the existing codepaths for premium lists at all, especially not on the read path. 2. Write premium lists to Cloud SQL only if requested (i.e. not by default), and write to Datastore first so as to not be blocked by errors with Cloud SQL. 3. Reuse existing codepaths to the maximum possible extent (e.g. don't yet re-implement premium list parsing; take advantage of the existing logic), but also ... 4. Some duplication is OK, since the existing Datastore path will be deleted once this migration is complete, leaving only the codepaths for Cloud SQL. * Refactor out common logic * Add DAO test * Add tests for parsing premium lists * Use containsExactly * Code review changes * Format * Re-generate schema * Fix column names * Make some tests pass * Add SQL migration scripts * Fix test errors
This commit is contained in:
parent
cb27459fbb
commit
f79c49d858
16 changed files with 432 additions and 46 deletions
17
db/src/main/resources/sql/flyway/V5__update_premium_list.sql
Normal file
17
db/src/main/resources/sql/flyway/V5__update_premium_list.sql
Normal file
|
@ -0,0 +1,17 @@
|
|||
-- Copyright 2019 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 "PremiumList" add column if not exists name text not null;
|
||||
|
||||
create index if not exists premiumlist_name_idx ON "PremiumList" (name);
|
|
@ -132,6 +132,7 @@
|
|||
revision_id bigserial not null,
|
||||
creation_timestamp timestamptz not null,
|
||||
currency bytea not null,
|
||||
name text not null,
|
||||
primary key (revision_id)
|
||||
);
|
||||
|
||||
|
@ -157,6 +158,7 @@
|
|||
|
||||
alter table if exists "Domain_GracePeriod"
|
||||
add constraint UK_4ps2u4y8i5r91wu2n1x2xea28 unique (grace_periods_id);
|
||||
create index premiumlist_name_idx on "PremiumList" (name);
|
||||
|
||||
alter table if exists "RegistryLock"
|
||||
add constraint idx_registry_lock_repo_id_revision_id unique (repo_id, revision_id);
|
||||
|
|
|
@ -91,7 +91,8 @@ CREATE TABLE public."PremiumEntry" (
|
|||
CREATE TABLE public."PremiumList" (
|
||||
revision_id bigint NOT NULL,
|
||||
creation_timestamp timestamp with time zone NOT NULL,
|
||||
currency bytea NOT NULL
|
||||
currency bytea NOT NULL,
|
||||
name text NOT NULL
|
||||
);
|
||||
|
||||
|
||||
|
@ -227,6 +228,13 @@ ALTER TABLE ONLY public."RegistryLock"
|
|||
CREATE INDEX idx_registry_lock_verification_code ON public."RegistryLock" USING btree (verification_code);
|
||||
|
||||
|
||||
--
|
||||
-- Name: premiumlist_name_idx; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX premiumlist_name_idx ON public."PremiumList" USING btree (name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: ClaimsEntry fk6sc6at5hedffc0nhdcab6ivuq; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue