mirror of
https://github.com/google/nomulus
synced 2026-05-01 13:26:05 +00:00
Change pkey of User to emailAddress (#2505)
Originally, we though that User entities were going to have mutable email addresses, and thus would require a non-changing primary key. This proved to not be the case. It'll simplify the User loading/saving code if we just do everything by email address. Obviously this doesn't change much functionality, but it prepares us for removing the id field down the line once the changes propagate.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -257,15 +257,15 @@ td.section {
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="property_name">generated by</td>
|
||||
<td class="property_value">SchemaCrawler 16.21.2</td>
|
||||
<td class="property_value">SchemaCrawler 16.21.4</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">generated on</td>
|
||||
<td class="property_value">2024-06-20 20:07:00</td>
|
||||
<td class="property_value">2024-07-25 18:42:05</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="property_name">last flyway file</td>
|
||||
<td id="lastFlywayFile" class="property_value">V173__create_feature_flag_table.sql</td>
|
||||
<td id="lastFlywayFile" class="property_value">V174__user_pkey.sql</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -278,9 +278,9 @@ td.section {
|
||||
</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-9412 4738,-9412 4738,4 -4,4" />
|
||||
<text text-anchor="start" x="4494" y="-29.8" font-family="Helvetica,sans-Serif" font-size="14.00">generated by</text>
|
||||
<text text-anchor="start" x="4577" y="-29.8" font-family="Helvetica,sans-Serif" font-size="14.00">SchemaCrawler 16.21.2</text>
|
||||
<text text-anchor="start" x="4577" y="-29.8" font-family="Helvetica,sans-Serif" font-size="14.00">SchemaCrawler 16.21.4</text>
|
||||
<text text-anchor="start" x="4493" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">generated on</text>
|
||||
<text text-anchor="start" x="4577" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">2024-06-20 20:07:00</text>
|
||||
<text text-anchor="start" x="4577" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">2024-07-25 18:42:05</text>
|
||||
<polygon fill="none" stroke="#888888" points="4490,-4 4490,-44 4726,-44 4726,-4 4490,-4" /> <!-- allocationtoken_a08ccbef -->
|
||||
<g id="node1" class="node">
|
||||
<title>
|
||||
@@ -2071,12 +2071,12 @@ td.section {
|
||||
<text text-anchor="start" x="713" y="-504.3" font-family="Helvetica,sans-Serif" font-weight="bold" font-style="italic" font-size="14.00">public."User"</text>
|
||||
<polygon fill="#e9c2f2" stroke="transparent" points="901,-497.5 901,-516.5 1011,-516.5 1011,-497.5 901,-497.5" />
|
||||
<text text-anchor="start" x="972" y="-503.3" font-family="Helvetica,sans-Serif" font-size="14.00">[table]</text>
|
||||
<text text-anchor="start" x="713" y="-485.3" font-family="Helvetica,sans-Serif" font-weight="bold" font-style="italic" font-size="14.00">id</text>
|
||||
<text text-anchor="start" x="713" y="-484.3" font-family="Helvetica,sans-Serif" font-size="14.00">id</text>
|
||||
<text text-anchor="start" x="895" y="-484.3" font-family="Helvetica,sans-Serif" font-size="14.00"> </text>
|
||||
<text text-anchor="start" x="903" y="-484.3" font-family="Helvetica,sans-Serif" font-size="14.00">bigserial not null</text>
|
||||
<text text-anchor="start" x="903" y="-484.3" font-family="Helvetica,sans-Serif" font-size="14.00">bigserial</text>
|
||||
<text text-anchor="start" x="895" y="-465.3" font-family="Helvetica,sans-Serif" font-size="14.00"> </text>
|
||||
<text text-anchor="start" x="903" y="-465.3" font-family="Helvetica,sans-Serif" font-size="14.00">auto-incremented</text>
|
||||
<text text-anchor="start" x="713" y="-446.3" font-family="Helvetica,sans-Serif" font-size="14.00">email_address</text>
|
||||
<text text-anchor="start" x="713" y="-447.3" font-family="Helvetica,sans-Serif" font-weight="bold" font-style="italic" font-size="14.00">email_address</text>
|
||||
<text text-anchor="start" x="895" y="-446.3" font-family="Helvetica,sans-Serif" font-size="14.00"> </text>
|
||||
<text text-anchor="start" x="903" y="-446.3" font-family="Helvetica,sans-Serif" font-size="14.00">text not null</text>
|
||||
<text text-anchor="start" x="713" y="-427.3" font-family="Helvetica,sans-Serif" font-size="14.00">registry_lock_password_hash</text>
|
||||
@@ -13113,8 +13113,8 @@ td.section {
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="spacer"></td>
|
||||
<td class="minwidth"><b><i>id</i></b></td>
|
||||
<td class="minwidth">bigserial not null</td>
|
||||
<td class="minwidth">id</td>
|
||||
<td class="minwidth">bigserial</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="spacer"></td>
|
||||
@@ -13123,7 +13123,7 @@ td.section {
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="spacer"></td>
|
||||
<td class="minwidth">email_address</td>
|
||||
<td class="minwidth"><b><i>email_address</i></b></td>
|
||||
<td class="minwidth">text not null</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -13176,7 +13176,7 @@ td.section {
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="spacer"></td>
|
||||
<td class="minwidth">id</td>
|
||||
<td class="minwidth">email_address</td>
|
||||
<td class="minwidth"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -13260,7 +13260,7 @@ td.section {
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="spacer"></td>
|
||||
<td class="minwidth">id</td>
|
||||
<td class="minwidth">email_address</td>
|
||||
<td class="minwidth">ascending</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -13275,18 +13275,6 @@ td.section {
|
||||
<td class="minwidth">email_address</td>
|
||||
<td class="minwidth">ascending</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="name">user_email_address_idx</td>
|
||||
<td class="description right">[non-unique index]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="spacer"></td>
|
||||
<td class="minwidth">email_address</td>
|
||||
<td class="minwidth">ascending</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p> </p>
|
||||
|
||||
@@ -171,3 +171,4 @@ V170__user_update_registry_lock_email.sql
|
||||
V171__drop_create_billing_cost_columns_from_tld.sql
|
||||
V172__allocation_token_renewal_price.sql
|
||||
V173__create_feature_flag_table.sql
|
||||
V174__user_pkey.sql
|
||||
|
||||
18
db/src/main/resources/sql/flyway/V174__user_pkey.sql
Normal file
18
db/src/main/resources/sql/flyway/V174__user_pkey.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- Copyright 2024 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 "User" DROP CONSTRAINT "User_pkey";
|
||||
ALTER TABLE "User" ADD CONSTRAINT "User_pkey" PRIMARY KEY (email_address);
|
||||
ALTER TABLE "User" ALTER COLUMN id DROP NOT NULL;
|
||||
DROP INDEX user_email_address_idx;
|
||||
@@ -885,16 +885,16 @@
|
||||
);
|
||||
|
||||
create table "User" (
|
||||
id bigserial not null,
|
||||
email_address text not null,
|
||||
update_timestamp timestamptz,
|
||||
email_address text not null,
|
||||
registry_lock_email_address text,
|
||||
registry_lock_password_hash text,
|
||||
registry_lock_password_salt text,
|
||||
global_role text not null,
|
||||
is_admin boolean not null,
|
||||
registrar_roles hstore,
|
||||
primary key (id)
|
||||
id int8,
|
||||
primary key (email_address)
|
||||
);
|
||||
|
||||
create table "UserUpdateHistory" (
|
||||
@@ -904,8 +904,8 @@
|
||||
history_request_body text,
|
||||
history_type text not null,
|
||||
history_url text not null,
|
||||
user_id int8 not null,
|
||||
email_address text not null,
|
||||
user_id int8 not null,
|
||||
registry_lock_email_address text,
|
||||
registry_lock_password_hash text,
|
||||
registry_lock_password_salt text,
|
||||
@@ -1016,17 +1016,13 @@ create index reservedlist_name_idx on "ReservedList" (name);
|
||||
create index spec11threatmatch_registrar_id_idx on "Spec11ThreatMatch" (registrar_id);
|
||||
create index spec11threatmatch_tld_idx on "Spec11ThreatMatch" (tld);
|
||||
create index spec11threatmatch_check_date_idx on "Spec11ThreatMatch" (check_date);
|
||||
create index user_email_address_idx on "User" (email_address);
|
||||
|
||||
alter table if exists "User"
|
||||
add constraint UK_seshmd8qn3lcffsjw5j8wnbnd unique (email_address);
|
||||
create index IDXbjacjlm8ianc4kxxvamnu94k5 on "UserUpdateHistory" (history_acting_user);
|
||||
create index IDX5yqacw829y5bm6f7eajsq1cts on "UserUpdateHistory" (email_address);
|
||||
|
||||
alter table if exists "ConsoleEppActionHistory"
|
||||
add constraint FKb686b9os2nsjpv930npa4r3b4
|
||||
foreign key (history_acting_user)
|
||||
references "User" (email_address);
|
||||
references "User";
|
||||
|
||||
alter table if exists "DelegationSignerData"
|
||||
add constraint FKtr24j9v14ph2mfuw2gsmt12kq
|
||||
@@ -1066,12 +1062,12 @@ create index IDX5yqacw829y5bm6f7eajsq1cts on "UserUpdateHistory" (email_address)
|
||||
alter table if exists "RegistrarPocUpdateHistory"
|
||||
add constraint FKftpbwctxtkc1i0njc0tdcaa2g
|
||||
foreign key (history_acting_user)
|
||||
references "User" (email_address);
|
||||
references "User";
|
||||
|
||||
alter table if exists "RegistrarUpdateHistory"
|
||||
add constraint FKsr7w342s7x5s5jvdti2axqeq8
|
||||
foreign key (history_acting_user)
|
||||
references "User" (email_address);
|
||||
references "User";
|
||||
|
||||
alter table if exists "RegistryLock"
|
||||
add constraint FK2lhcwpxlnqijr96irylrh1707
|
||||
@@ -1086,4 +1082,4 @@ create index IDX5yqacw829y5bm6f7eajsq1cts on "UserUpdateHistory" (email_address)
|
||||
alter table if exists "UserUpdateHistory"
|
||||
add constraint FK1s7bopbl3pwrhv3jkkofnv3o0
|
||||
foreign key (history_acting_user)
|
||||
references "User" (email_address);
|
||||
references "User";
|
||||
|
||||
@@ -1317,7 +1317,7 @@ CREATE TABLE public."TmchCrl" (
|
||||
--
|
||||
|
||||
CREATE TABLE public."User" (
|
||||
id bigint NOT NULL,
|
||||
id bigint,
|
||||
email_address text NOT NULL,
|
||||
registry_lock_password_hash text,
|
||||
registry_lock_password_salt text,
|
||||
@@ -1833,7 +1833,7 @@ ALTER TABLE ONLY public."UserUpdateHistory"
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public."User"
|
||||
ADD CONSTRAINT "User_pkey" PRIMARY KEY (id);
|
||||
ADD CONSTRAINT "User_pkey" PRIMARY KEY (email_address);
|
||||
|
||||
|
||||
--
|
||||
@@ -2547,13 +2547,6 @@ CREATE INDEX spec11threatmatch_registrar_id_idx ON public."Spec11ThreatMatch" US
|
||||
CREATE INDEX spec11threatmatch_tld_idx ON public."Spec11ThreatMatch" USING btree (tld);
|
||||
|
||||
|
||||
--
|
||||
-- Name: user_email_address_idx; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX user_email_address_idx ON public."User" USING btree (email_address);
|
||||
|
||||
|
||||
--
|
||||
-- Name: UserUpdateHistory fk1s7bopbl3pwrhv3jkkofnv3o0; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user