Add RegistryLock SQL schema (#243)

* Add RegistryLock SQL schema

* Refactor a bit

* Move registrylock -> domain

* Clearing up lock workflow

* Add more docs and remove LockStatus

* Responses to CR

* Add repoId javadoc

* Add registry lock to persistence xml file

* Quote rather than backtick

* Remove unnecessary check

* File TODO

* Remove uniqueness constraint on verification code

* Remove import

* add index

* Add to SQL generation task

* Move fields around to be the same order as Hibernate's generated sql
This commit is contained in:
gbrodman 2019-09-10 18:17:36 -04:00 committed by GitHub
parent 97ee4c3778
commit 1e7d4bded9
4 changed files with 270 additions and 0 deletions

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);