From beb7c14adb029241094dcaf15eef55e7d2b0f7e1 Mon Sep 17 00:00:00 2001 From: gbrodman Date: Tue, 30 Jul 2024 15:19:29 -0400 Subject: [PATCH] Drop not-null constraint on UserUpdateHistory:user_id (#2513) This is nullable now that we're switching from using an ID field to using the email address as the primary identifier. --- .../sql/er_diagram/brief_er_diagram.html | 6 +++--- .../resources/sql/er_diagram/full_er_diagram.html | 10 +++++----- db/src/main/resources/sql/flyway.txt | 1 + .../sql/flyway/V175__user_update_history_id.sql | 15 +++++++++++++++ .../main/resources/sql/schema/nomulus.golden.sql | 2 +- 5 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 db/src/main/resources/sql/flyway/V175__user_update_history_id.sql diff --git a/db/src/main/resources/sql/er_diagram/brief_er_diagram.html b/db/src/main/resources/sql/er_diagram/brief_er_diagram.html index 8756cbde4..e60a6ec04 100644 --- a/db/src/main/resources/sql/er_diagram/brief_er_diagram.html +++ b/db/src/main/resources/sql/er_diagram/brief_er_diagram.html @@ -261,11 +261,11 @@ td.section { generated on - 2024-07-25 18:42:06 + 2024-07-30 18:27:56 last flyway file - V174__user_pkey.sql + V175__user_update_history_id.sql @@ -280,7 +280,7 @@ td.section { generated by SchemaCrawler 16.21.4 generated on - 2024-07-25 18:42:06 + 2024-07-30 18:27:56 diff --git a/db/src/main/resources/sql/er_diagram/full_er_diagram.html b/db/src/main/resources/sql/er_diagram/full_er_diagram.html index 8744458f4..af00bbee6 100644 --- a/db/src/main/resources/sql/er_diagram/full_er_diagram.html +++ b/db/src/main/resources/sql/er_diagram/full_er_diagram.html @@ -261,11 +261,11 @@ td.section { </tr> <tr> <td class="property_name">generated on</td> - <td class="property_value">2024-07-25 18:42:05</td> + <td class="property_value">2024-07-30 18:27:55</td> </tr> <tr> <td class="property_name">last flyway file</td> - <td id="lastFlywayFile" class="property_value">V174__user_pkey.sql</td> + <td id="lastFlywayFile" class="property_value">V175__user_update_history_id.sql</td> </tr> </tbody> </table> @@ -280,7 +280,7 @@ td.section { <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.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-07-25 18:42:05</text> + <text text-anchor="start" x="4577" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">2024-07-30 18:27:55</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> @@ -4065,7 +4065,7 @@ td.section { <text text-anchor="start" x="1594" y="-485.3" font-family="Helvetica,sans-Serif" font-size="14.00">text not null</text> <text text-anchor="start" x="1404" y="-466.3" font-family="Helvetica,sans-Serif" font-size="14.00">user_id</text> <text text-anchor="start" x="1586" y="-466.3" font-family="Helvetica,sans-Serif" font-size="14.00"> </text> - <text text-anchor="start" x="1594" y="-466.3" font-family="Helvetica,sans-Serif" font-size="14.00">int8 not null</text> + <text text-anchor="start" x="1594" y="-466.3" font-family="Helvetica,sans-Serif" font-size="14.00">int8</text> <text text-anchor="start" x="1404" y="-447.3" font-family="Helvetica,sans-Serif" font-size="14.00">email_address</text> <text text-anchor="start" x="1586" y="-447.3" font-family="Helvetica,sans-Serif" font-size="14.00"> </text> <text text-anchor="start" x="1594" y="-447.3" font-family="Helvetica,sans-Serif" font-size="14.00">text not null</text> @@ -13316,7 +13316,7 @@ td.section { <tr> <td class="spacer"></td> <td class="minwidth">user_id</td> - <td class="minwidth">int8 not null</td> + <td class="minwidth">int8</td> </tr> <tr> <td class="spacer"></td> diff --git a/db/src/main/resources/sql/flyway.txt b/db/src/main/resources/sql/flyway.txt index cc5511486..e9799dcfe 100644 --- a/db/src/main/resources/sql/flyway.txt +++ b/db/src/main/resources/sql/flyway.txt @@ -172,3 +172,4 @@ 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 +V175__user_update_history_id.sql diff --git a/db/src/main/resources/sql/flyway/V175__user_update_history_id.sql b/db/src/main/resources/sql/flyway/V175__user_update_history_id.sql new file mode 100644 index 000000000..f2b691c49 --- /dev/null +++ b/db/src/main/resources/sql/flyway/V175__user_update_history_id.sql @@ -0,0 +1,15 @@ +-- 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 "UserUpdateHistory" ALTER COLUMN user_id DROP NOT NULL; diff --git a/db/src/main/resources/sql/schema/nomulus.golden.sql b/db/src/main/resources/sql/schema/nomulus.golden.sql index 48230f613..400bad24f 100644 --- a/db/src/main/resources/sql/schema/nomulus.golden.sql +++ b/db/src/main/resources/sql/schema/nomulus.golden.sql @@ -1340,7 +1340,7 @@ CREATE TABLE public."UserUpdateHistory" ( history_request_body text, history_type text NOT NULL, history_url text NOT NULL, - user_id bigint NOT NULL, + user_id bigint, email_address text NOT NULL, registry_lock_password_hash text, registry_lock_password_salt text,