Add RegistryLock schema to Flyway deployment folder (#270)

* Add RegistryLock schema to Flyway deployment folder

Added creation script of RegistryLock to Flyway deployment folder.

Fixed previous scripts (PremiumList- and ClaimsList-related) for
FK name change (cause by table name changes: names are quoted now).
We should consider generating foreign key names by ourselves.

Since the alpha database is empty, we dropped and recreated the schema.

Added instructions on how to submit new database incremental changes
in the README file.

Updated RegistryLock.java, removing unnecessary annotations:
- For most fields, the 'name=' property is no longer necessary not that
  the naming strategy is in place. The exceptions are the two used in
  the unique index.
- The @Column annotation is implicit.
This commit is contained in:
Weimin Yu 2019-09-16 16:47:58 -04:00 committed by GitHub
parent f1360285d6
commit 04b076eb0a
6 changed files with 147 additions and 27 deletions

View file

@ -26,6 +26,6 @@
);
alter table if exists "ClaimsEntry"
add constraint FKlugn0q07ayrtar87dqi3vs3c8
add constraint FK6sc6at5hedffc0nhdcab6ivuq
foreign key (revision_id)
references "ClaimsList";

View file

@ -27,6 +27,6 @@
);
alter table if exists "PremiumEntry"
add constraint FKqebdja3jkx9c9cnqnrw9g9ocu
add constraint FKo0gw90lpo1tuee56l0nb6y6g5
foreign key (revision_id)
references "PremiumList";

View file

@ -0,0 +1,30 @@
-- 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.
create table "RegistryLock" (
revision_id bigserial not null,
action text not null,
completion_timestamp timestamptz,
creation_timestamp timestamptz not null,
domain_name text not null,
is_superuser boolean not null,
registrar_id text not null,
registrar_poc_id text,
repo_id text not null,
verification_code text not null,
primary key (revision_id)
);
alter table if exists "RegistryLock"
add constraint idx_registry_lock_repo_id_revision_id unique (repo_id, revision_id);

View file

@ -114,6 +114,43 @@ CREATE SEQUENCE public."PremiumList_revision_id_seq"
ALTER SEQUENCE public."PremiumList_revision_id_seq" OWNED BY public."PremiumList".revision_id;
--
-- Name: RegistryLock; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."RegistryLock" (
revision_id bigint NOT NULL,
action text NOT NULL,
completion_timestamp timestamp with time zone,
creation_timestamp timestamp with time zone NOT NULL,
domain_name text NOT NULL,
is_superuser boolean NOT NULL,
registrar_id text NOT NULL,
registrar_poc_id text,
repo_id text NOT NULL,
verification_code text NOT NULL
);
--
-- Name: RegistryLock_revision_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."RegistryLock_revision_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: RegistryLock_revision_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."RegistryLock_revision_id_seq" OWNED BY public."RegistryLock".revision_id;
--
-- Name: ClaimsList revision_id; Type: DEFAULT; Schema: public; Owner: -
--
@ -128,6 +165,13 @@ ALTER TABLE ONLY public."ClaimsList" ALTER COLUMN revision_id SET DEFAULT nextva
ALTER TABLE ONLY public."PremiumList" ALTER COLUMN revision_id SET DEFAULT nextval('public."PremiumList_revision_id_seq"'::regclass);
--
-- Name: RegistryLock revision_id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."RegistryLock" ALTER COLUMN revision_id SET DEFAULT nextval('public."RegistryLock_revision_id_seq"'::regclass);
--
-- Name: ClaimsEntry ClaimsEntry_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
@ -161,19 +205,35 @@ ALTER TABLE ONLY public."PremiumList"
--
-- Name: ClaimsEntry fklugn0q07ayrtar87dqi3vs3c8; Type: FK CONSTRAINT; Schema: public; Owner: -
-- Name: RegistryLock RegistryLock_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."RegistryLock"
ADD CONSTRAINT "RegistryLock_pkey" PRIMARY KEY (revision_id);
--
-- Name: RegistryLock idx_registry_lock_repo_id_revision_id; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."RegistryLock"
ADD CONSTRAINT idx_registry_lock_repo_id_revision_id UNIQUE (repo_id, revision_id);
--
-- Name: ClaimsEntry fk6sc6at5hedffc0nhdcab6ivuq; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."ClaimsEntry"
ADD CONSTRAINT fklugn0q07ayrtar87dqi3vs3c8 FOREIGN KEY (revision_id) REFERENCES public."ClaimsList"(revision_id);
ADD CONSTRAINT fk6sc6at5hedffc0nhdcab6ivuq FOREIGN KEY (revision_id) REFERENCES public."ClaimsList"(revision_id);
--
-- Name: PremiumEntry fkqebdja3jkx9c9cnqnrw9g9ocu; Type: FK CONSTRAINT; Schema: public; Owner: -
-- Name: PremiumEntry fko0gw90lpo1tuee56l0nb6y6g5; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PremiumEntry"
ADD CONSTRAINT fkqebdja3jkx9c9cnqnrw9g9ocu FOREIGN KEY (revision_id) REFERENCES public."PremiumList"(revision_id);
ADD CONSTRAINT fko0gw90lpo1tuee56l0nb6y6g5 FOREIGN KEY (revision_id) REFERENCES public."PremiumList"(revision_id);
--