1
0
mirror of https://github.com/google/nomulus synced 2026-07-20 15:02:30 +00:00

Fix a few DB issues with the User class (#1766)

- Create a sequence to generate IDs for the user (this allows us to have
  Long ID types so that Hibernate can autogenerate IDs)
- Add an update timestamp column so we can extend BackupGroupRoot
- Add a restriction that there can't be multiple users with the same
  email address
This commit is contained in:
gbrodman
2022-08-31 16:09:07 -04:00
committed by GitHub
parent 06a1fc0022
commit ddc4a615db
5 changed files with 165 additions and 58 deletions
@@ -1066,10 +1066,30 @@ CREATE TABLE public."User" (
registry_lock_password_salt text,
global_role text NOT NULL,
is_admin boolean NOT NULL,
registrar_roles public.hstore NOT NULL
registrar_roles public.hstore NOT NULL,
update_timestamp timestamp with time zone
);
--
-- Name: User_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."User_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: User_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."User_id_seq" OWNED BY public."User".id;
--
-- Name: ClaimsList revision_id; Type: DEFAULT; Schema: public; Owner: -
--
@@ -1119,6 +1139,13 @@ ALTER TABLE ONLY public."SignedMarkRevocationList" ALTER COLUMN revision_id SET
ALTER TABLE ONLY public."Spec11ThreatMatch" ALTER COLUMN id SET DEFAULT nextval('public."SafeBrowsingThreat_id_seq"'::regclass);
--
-- Name: User id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."User" ALTER COLUMN id SET DEFAULT nextval('public."User_id_seq"'::regclass);
--
-- Name: AllocationToken AllocationToken_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
@@ -1439,6 +1466,14 @@ ALTER TABLE ONLY public."DomainHistoryHost"
ADD CONSTRAINT ukt2e7ae3t8gcsxd13wjx2ka7ij UNIQUE (domain_history_history_revision_id, domain_history_domain_repo_id, host_repo_id);
--
-- Name: User user_unique_email; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."User"
ADD CONSTRAINT user_unique_email UNIQUE (email_address);
--
-- Name: allocation_token_domain_name_idx; Type: INDEX; Schema: public; Owner: -
--