diff --git a/core/src/main/java/google/registry/model/contact/ContactResource.java b/core/src/main/java/google/registry/model/contact/ContactResource.java index ec33fe886..6cc66b8f8 100644 --- a/core/src/main/java/google/registry/model/contact/ContactResource.java +++ b/core/src/main/java/google/registry/model/contact/ContactResource.java @@ -40,7 +40,7 @@ import org.joda.time.DateTime; @javax.persistence.Index(columnList = "creationTime"), @javax.persistence.Index(columnList = "currentSponsorRegistrarId"), @javax.persistence.Index(columnList = "deletionTime"), - @javax.persistence.Index(columnList = "contactId", unique = true), + @javax.persistence.Index(columnList = "contactId"), @javax.persistence.Index(columnList = "searchName") }) @ExternalMessagingName("contact") diff --git a/db/src/main/resources/sql/flyway/V46__Contact_contactId_index_to_non_unique.sql b/db/src/main/resources/sql/flyway/V46__Contact_contactId_index_to_non_unique.sql new file mode 100644 index 000000000..f33dffc0e --- /dev/null +++ b/db/src/main/resources/sql/flyway/V46__Contact_contactId_index_to_non_unique.sql @@ -0,0 +1,18 @@ +-- Copyright 2020 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 index IDXoqd7n4hbx86hvlgkilq75olas on "Contact" (contact_id); + +alter table if exists "Contact" + drop constraint if exists ukoqd7n4hbx86hvlgkilq75olas cascade; diff --git a/db/src/main/resources/sql/schema/db-schema.sql.generated b/db/src/main/resources/sql/schema/db-schema.sql.generated index 3a849b02e..4c6ff4c6a 100644 --- a/db/src/main/resources/sql/schema/db-schema.sql.generated +++ b/db/src/main/resources/sql/schema/db-schema.sql.generated @@ -580,10 +580,8 @@ create index IDXjny8wuot75b5e6p38r47wdawu on "BillingRecurrence" (recurrence_tim create index IDX3y752kr9uh4kh6uig54vemx0l on "Contact" (creation_time); create index IDXtm415d6fe1rr35stm33s5mg18 on "Contact" (current_sponsor_registrar_id); create index IDXn1f711wicdnooa2mqb7g1m55o on "Contact" (deletion_time); +create index IDXoqd7n4hbx86hvlgkilq75olas on "Contact" (contact_id); create index IDX1p3esngcwwu6hstyua6itn6ff on "Contact" (search_name); - - alter table if exists "Contact" - add constraint UKoqd7n4hbx86hvlgkilq75olas unique (contact_id); create index IDXo1xdtpij2yryh0skxe9v91sep on "ContactHistory" (creation_time); create index IDXhp33wybmb6tbpr1bq7ttwk8je on "ContactHistory" (history_registrar_id); create index IDX9q53px6r302ftgisqifmc6put on "ContactHistory" (history_type); diff --git a/db/src/main/resources/sql/schema/nomulus.golden.sql b/db/src/main/resources/sql/schema/nomulus.golden.sql index bb46d4ac2..bae8e5ff2 100644 --- a/db/src/main/resources/sql/schema/nomulus.golden.sql +++ b/db/src/main/resources/sql/schema/nomulus.golden.sql @@ -1183,14 +1183,6 @@ ALTER TABLE ONLY public."RegistryLock" ADD CONSTRAINT idx_registry_lock_repo_id_revision_id UNIQUE (repo_id, revision_id); --- --- Name: Contact ukoqd7n4hbx86hvlgkilq75olas; Type: CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public."Contact" - ADD CONSTRAINT ukoqd7n4hbx86hvlgkilq75olas UNIQUE (contact_id); - - -- -- Name: idx1iy7njgb7wjmj9piml4l2g0qi; Type: INDEX; Schema: public; Owner: - -- @@ -1415,6 +1407,13 @@ CREATE INDEX idxn898pb9mwcg359cdwvolb11ck ON public."BillingRecurrence" USING bt CREATE INDEX idxo1xdtpij2yryh0skxe9v91sep ON public."ContactHistory" USING btree (creation_time); +-- +-- Name: idxoqd7n4hbx86hvlgkilq75olas; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idxoqd7n4hbx86hvlgkilq75olas ON public."Contact" USING btree (contact_id); + + -- -- Name: idxp3usbtvk0v1m14i5tdp4xnxgc; Type: INDEX; Schema: public; Owner: - --