From 56c9e81bcd415346e78c2a7fdf6e8a17841fef0f Mon Sep 17 00:00:00 2001 From: Shicong Huang Date: Tue, 16 Jun 2020 10:42:57 -0400 Subject: [PATCH] Refactor TransferData to remove unused fields in Contact table (#623) * Add DomainTransferData and ContactTransferData * Refactor TransferData to remove unused fields in Contact table * Add scope for TransferData's type parameter --- .../contact/ContactTransferRequestFlow.java | 21 +- .../domain/DomainTransferApproveFlow.java | 4 +- .../flows/domain/DomainTransferQueryFlow.java | 4 +- .../domain/DomainTransferRequestFlow.java | 6 +- .../flows/domain/DomainTransferUtils.java | 9 +- .../google/registry/model/EppResource.java | 9 +- .../registry/model/EppResourceUtils.java | 34 ++-- .../registry/model/ResourceTransferUtils.java | 26 +-- .../model/contact/ContactResource.java | 14 +- .../registry/model/domain/DomainBase.java | 20 +- .../model/transfer/BaseTransferObject.java | 5 + .../model/transfer/ContactTransferData.java | 48 +++++ .../model/transfer/DomainTransferData.java | 186 ++++++++++++++++++ .../registry/model/transfer/TransferData.java | 168 +++------------- .../rde/ContactResourceToXjcConverter.java | 3 +- .../rde/DomainBaseToXjcConverter.java | 5 +- .../DeleteContactsAndHostsActionTest.java | 3 +- .../ContactTransferRequestFlowTest.java | 8 +- .../flows/domain/DomainDeleteFlowTest.java | 6 +- .../domain/DomainTransferApproveFlowTest.java | 10 +- .../domain/DomainTransferRequestFlowTest.java | 4 +- .../flows/host/HostDeleteFlowTest.java | 6 +- .../flows/host/HostUpdateFlowTest.java | 4 +- .../model/contact/ContactResourceTest.java | 7 +- .../model/domain/DomainBaseSqlTest.java | 4 +- .../registry/model/domain/DomainBaseTest.java | 24 +-- .../registry/model/host/HostResourceTest.java | 4 +- .../model/transfer/TransferDataTest.java | 6 +- .../registry/rdap/RdapJsonFormatterTest.java | 4 +- .../ContactResourceToXjcConverterTest.java | 71 +++---- .../rde/DomainBaseToXjcConverterTest.java | 4 +- .../java/google/registry/rde/RdeFixtures.java | 4 +- .../registry/testing/DatastoreHelper.java | 24 ++- .../registry/whois/WhoisActionTest.java | 4 +- .../google/registry/model/schema.txt | 15 +- ...used_transafer_data_columns_in_contact.sql | 21 ++ .../sql/schema/db-schema.sql.generated | 13 +- .../resources/sql/schema/nomulus.golden.sql | 7 - 38 files changed, 491 insertions(+), 324 deletions(-) create mode 100644 core/src/main/java/google/registry/model/transfer/ContactTransferData.java create mode 100644 core/src/main/java/google/registry/model/transfer/DomainTransferData.java create mode 100644 db/src/main/resources/sql/flyway/V32__drop_unused_transafer_data_columns_in_contact.sql diff --git a/core/src/main/java/google/registry/flows/contact/ContactTransferRequestFlow.java b/core/src/main/java/google/registry/flows/contact/ContactTransferRequestFlow.java index 51eb43bf7..1f8f5b2f8 100644 --- a/core/src/main/java/google/registry/flows/contact/ContactTransferRequestFlow.java +++ b/core/src/main/java/google/registry/flows/contact/ContactTransferRequestFlow.java @@ -46,7 +46,7 @@ import google.registry.model.eppoutput.EppResponse; import google.registry.model.poll.PollMessage; import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.IcannReportingTypes.ActivityReportField; -import google.registry.model.transfer.TransferData; +import google.registry.model.transfer.ContactTransferData; import google.registry.model.transfer.TransferStatus; import java.util.Optional; import javax.inject.Inject; @@ -112,21 +112,22 @@ public final class ContactTransferRequestFlow implements TransactionalFlow { .setParent(Key.create(existingContact)) .build(); DateTime transferExpirationTime = now.plus(automaticTransferLength); - TransferData serverApproveTransferData = new TransferData.Builder() - .setTransferRequestTime(now) - .setTransferRequestTrid(trid) - .setGainingClientId(gainingClientId) - .setLosingClientId(losingClientId) - .setPendingTransferExpirationTime(transferExpirationTime) - .setTransferStatus(TransferStatus.SERVER_APPROVED) - .build(); + ContactTransferData serverApproveTransferData = + new ContactTransferData.Builder() + .setTransferRequestTime(now) + .setTransferRequestTrid(trid) + .setGainingClientId(gainingClientId) + .setLosingClientId(losingClientId) + .setPendingTransferExpirationTime(transferExpirationTime) + .setTransferStatus(TransferStatus.SERVER_APPROVED) + .build(); // If the transfer is server approved, this message will be sent to the losing registrar. */ PollMessage serverApproveLosingPollMessage = createLosingTransferPollMessage(targetId, serverApproveTransferData, historyEntry); // If the transfer is server approved, this message will be sent to the gaining registrar. */ PollMessage serverApproveGainingPollMessage = createGainingTransferPollMessage(targetId, serverApproveTransferData, historyEntry); - TransferData pendingTransferData = + ContactTransferData pendingTransferData = serverApproveTransferData .asBuilder() .setTransferStatus(TransferStatus.PENDING) diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferApproveFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferApproveFlow.java index 5096b989d..a86392ef8 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferApproveFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferApproveFlow.java @@ -58,7 +58,7 @@ import google.registry.model.registry.Registry; import google.registry.model.reporting.DomainTransactionRecord; import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.IcannReportingTypes.ActivityReportField; -import google.registry.model.transfer.TransferData; +import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.TransferStatus; import java.util.Optional; import javax.inject.Inject; @@ -112,7 +112,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow { if (!isSuperuser) { checkAllowedAccessToTld(clientId, tld); } - TransferData transferData = existingDomain.getTransferData(); + DomainTransferData transferData = existingDomain.getTransferData(); String gainingClientId = transferData.getGainingClientId(); Registry registry = Registry.get(existingDomain.getTld()); HistoryEntry historyEntry = buildHistoryEntry(existingDomain, registry, now, gainingClientId); diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferQueryFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferQueryFlow.java index 4b92e79b6..417eff215 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferQueryFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferQueryFlow.java @@ -32,7 +32,7 @@ import google.registry.model.domain.DomainBase; import google.registry.model.eppcommon.AuthInfo; import google.registry.model.eppoutput.EppResponse; import google.registry.model.reporting.IcannReportingTypes.ActivityReportField; -import google.registry.model.transfer.TransferData; +import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.TransferStatus; import google.registry.util.Clock; import java.util.Optional; @@ -74,7 +74,7 @@ public final class DomainTransferQueryFlow implements Flow { verifyOptionalAuthInfo(authInfo, domain); // Most of the fields on the transfer response are required, so there's no way to return valid // XML if the object has never been transferred (and hence the fields aren't populated). - TransferData transferData = domain.getTransferData(); + DomainTransferData transferData = domain.getTransferData(); if (transferData.getTransferStatus() == null) { throw new NoTransferHistoryToQueryException(); } diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java b/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java index 8f4dee0c0..e00bc878d 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java @@ -69,7 +69,7 @@ import google.registry.model.reporting.DomainTransactionRecord; import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField; import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.IcannReportingTypes.ActivityReportField; -import google.registry.model.transfer.TransferData; +import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.TransferData.TransferServerApproveEntity; import google.registry.model.transfer.TransferResponse.DomainTransferResponse; import google.registry.model.transfer.TransferStatus; @@ -198,9 +198,9 @@ public final class DomainTransferRequestFlow implements TransactionalFlow { feesAndCredits.map(FeesAndCredits::getTotalCost), now); // Create the transfer data that represents the pending transfer. - TransferData pendingTransferData = + DomainTransferData pendingTransferData = createPendingTransferData( - new TransferData.Builder() + new DomainTransferData.Builder() .setTransferRequestTrid(trid) .setTransferRequestTime(now) .setGainingClientId(gainingClientId) diff --git a/core/src/main/java/google/registry/flows/domain/DomainTransferUtils.java b/core/src/main/java/google/registry/flows/domain/DomainTransferUtils.java index baad641c3..22af4cadd 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainTransferUtils.java +++ b/core/src/main/java/google/registry/flows/domain/DomainTransferUtils.java @@ -32,6 +32,7 @@ import google.registry.model.poll.PendingActionNotificationResponse.DomainPendin import google.registry.model.poll.PollMessage; import google.registry.model.registry.Registry; import google.registry.model.reporting.HistoryEntry; +import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.TransferData; import google.registry.model.transfer.TransferData.TransferServerApproveEntity; import google.registry.model.transfer.TransferResponse.DomainTransferResponse; @@ -48,8 +49,8 @@ import org.joda.time.DateTime; public final class DomainTransferUtils { /** Sets up {@link TransferData} for a domain with links to entities for server approval. */ - public static TransferData createPendingTransferData( - TransferData.Builder transferDataBuilder, + public static DomainTransferData createPendingTransferData( + DomainTransferData.Builder transferDataBuilder, ImmutableSet serverApproveEntities, Period transferPeriod) { ImmutableSet.Builder> serverApproveEntityKeys = @@ -110,8 +111,8 @@ public final class DomainTransferUtils { DateTime now) { String targetId = existingDomain.getFullyQualifiedDomainName(); // Create a TransferData for the server-approve case to use for the speculative poll messages. - TransferData serverApproveTransferData = - new TransferData.Builder() + DomainTransferData serverApproveTransferData = + new DomainTransferData.Builder() .setTransferRequestTrid(trid) .setTransferRequestTime(now) .setGainingClientId(gainingClientId) diff --git a/core/src/main/java/google/registry/model/EppResource.java b/core/src/main/java/google/registry/model/EppResource.java index ac8b34c9d..81531b37c 100644 --- a/core/src/main/java/google/registry/model/EppResource.java +++ b/core/src/main/java/google/registry/model/EppResource.java @@ -193,8 +193,8 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable { public interface ForeignKeyedEppResource {} /** An interface for resources that have transfer data. */ - public interface ResourceWithTransferData { - TransferData getTransferData(); + public interface ResourceWithTransferData { + T getTransferData(); /** * The time that this resource was last transferred. @@ -205,8 +205,9 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable { } /** An interface for builders of resources that have transfer data. */ - public interface BuilderWithTransferData> { - B setTransferData(TransferData transferData); + public interface BuilderWithTransferData< + T extends TransferData, B extends BuilderWithTransferData> { + B setTransferData(T transferData); /** Set the time when this resource was transferred. */ B setLastTransferTime(DateTime lastTransferTime); diff --git a/core/src/main/java/google/registry/model/EppResourceUtils.java b/core/src/main/java/google/registry/model/EppResourceUtils.java index 678021648..10d09e393 100644 --- a/core/src/main/java/google/registry/model/EppResourceUtils.java +++ b/core/src/main/java/google/registry/model/EppResourceUtils.java @@ -39,6 +39,7 @@ import google.registry.model.index.ForeignKeyIndex; import google.registry.model.ofy.CommitLogManifest; import google.registry.model.ofy.CommitLogMutation; import google.registry.model.registry.Registry; +import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.TransferData; import google.registry.model.transfer.TransferStatus; import java.util.List; @@ -222,17 +223,23 @@ public final class EppResourceUtils { } /** Process an automatic transfer on a resource. */ - public static & BuilderWithTransferData> + public static < + T extends TransferData, + B extends EppResource.Builder & BuilderWithTransferData> void setAutomaticTransferSuccessProperties(B builder, TransferData transferData) { checkArgument(TransferStatus.PENDING.equals(transferData.getTransferStatus())); - builder.removeStatusValue(StatusValue.PENDING_TRANSFER) - .setTransferData(transferData.asBuilder() - .setTransferStatus(TransferStatus.SERVER_APPROVED) - .setServerApproveEntities(null) - .setServerApproveBillingEvent(null) - .setServerApproveAutorenewEvent(null) - .setServerApproveAutorenewPollMessage(null) - .build()) + TransferData.Builder transferDataBuilder = transferData.asBuilder(); + transferDataBuilder.setTransferStatus(TransferStatus.SERVER_APPROVED); + transferDataBuilder.setServerApproveEntities(null); + if (transferData instanceof DomainTransferData) { + ((DomainTransferData.Builder) transferDataBuilder) + .setServerApproveBillingEvent(null) + .setServerApproveAutorenewEvent(null) + .setServerApproveAutorenewPollMessage(null); + } + builder + .removeStatusValue(StatusValue.PENDING_TRANSFER) + .setTransferData((T) transferDataBuilder.build()) .setLastTransferTime(transferData.getPendingTransferExpirationTime()) .setPersistedCurrentSponsorClientId(transferData.getGainingClientId()); } @@ -245,10 +252,11 @@ public final class EppResourceUtils { * */ public static < - T extends EppResource & ResourceWithTransferData, - B extends EppResource.Builder & BuilderWithTransferData> - void projectResourceOntoBuilderAtTime(T resource, B builder, DateTime now) { - TransferData transferData = resource.getTransferData(); + T extends TransferData, + E extends EppResource & ResourceWithTransferData, + B extends EppResource.Builder & BuilderWithTransferData> + void projectResourceOntoBuilderAtTime(E resource, B builder, DateTime now) { + T transferData = resource.getTransferData(); // If there's a pending transfer that has expired, process it. DateTime expirationTime = transferData.getPendingTransferExpirationTime(); if (TransferStatus.PENDING.equals(transferData.getTransferStatus()) diff --git a/core/src/main/java/google/registry/model/ResourceTransferUtils.java b/core/src/main/java/google/registry/model/ResourceTransferUtils.java index e5ccd8f24..20fcaf3e7 100644 --- a/core/src/main/java/google/registry/model/ResourceTransferUtils.java +++ b/core/src/main/java/google/registry/model/ResourceTransferUtils.java @@ -36,6 +36,7 @@ import google.registry.model.poll.PendingActionNotificationResponse.ContactPendi import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse; import google.registry.model.poll.PollMessage; import google.registry.model.reporting.HistoryEntry; +import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.TransferData; import google.registry.model.transfer.TransferResponse; import google.registry.model.transfer.TransferResponse.ContactTransferResponse; @@ -63,12 +64,13 @@ public final class ResourceTransferUtils { if (eppResource instanceof ContactResource) { builder = new ContactTransferResponse.Builder().setContactId(eppResource.getForeignKey()); } else { + DomainTransferData domainTransferData = (DomainTransferData) transferData; builder = new DomainTransferResponse.Builder() .setFullyQualifiedDomainName(eppResource.getForeignKey()) .setExtendedRegistrationExpirationTime( - ADD_EXDATE_STATUSES.contains(transferData.getTransferStatus()) - ? transferData.getTransferredRegistrationExpirationTime() + ADD_EXDATE_STATUSES.contains(domainTransferData.getTransferStatus()) + ? domainTransferData.getTransferredRegistrationExpirationTime() : null); } builder.setGainingClientId(transferData.getGainingClientId()) @@ -142,23 +144,25 @@ public final class ResourceTransferUtils { */ private static < R extends EppResource & ResourceWithTransferData, - B extends EppResource.Builder & BuilderWithTransferData> + B extends EppResource.Builder & BuilderWithTransferData> B resolvePendingTransfer(R resource, TransferStatus transferStatus, DateTime now) { checkArgument( resource.getStatusValues().contains(StatusValue.PENDING_TRANSFER), "Resource is not in pending transfer status."); - checkArgument( - !TransferData.EMPTY.equals(resource.getTransferData()), - "No old transfer data to resolve."); + checkArgument(!resource.getTransferData().isEmpty(), "No old transfer data to resolve."); @SuppressWarnings("unchecked") B builder = (B) resource.asBuilder(); + return builder .removeStatusValue(StatusValue.PENDING_TRANSFER) .setTransferData( - resource.getTransferData().copyConstantFieldsToBuilder() - .setTransferStatus(transferStatus) - .setPendingTransferExpirationTime(checkNotNull(now)) - .build()); + (TransferData) + resource + .getTransferData() + .copyConstantFieldsToBuilder() + .setTransferStatus(transferStatus) + .setPendingTransferExpirationTime(checkNotNull(now)) + .build()); } /** @@ -171,7 +175,7 @@ public final class ResourceTransferUtils { */ public static < R extends EppResource & ResourceWithTransferData, - B extends EppResource.Builder & BuilderWithTransferData> + B extends EppResource.Builder & BuilderWithTransferData> R approvePendingTransfer(R resource, TransferStatus transferStatus, DateTime now) { checkArgument(transferStatus.isApproved(), "Not an approval transfer status"); B builder = resolvePendingTransfer(resource, transferStatus, now); 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 1c9904b9f..30a984fdf 100644 --- a/core/src/main/java/google/registry/model/contact/ContactResource.java +++ b/core/src/main/java/google/registry/model/contact/ContactResource.java @@ -30,7 +30,7 @@ import google.registry.model.EppResource.ResourceWithTransferData; import google.registry.model.annotations.ExternalMessagingName; import google.registry.model.annotations.ReportedOn; import google.registry.model.contact.PostalInfo.Type; -import google.registry.model.transfer.TransferData; +import google.registry.model.transfer.ContactTransferData; import google.registry.persistence.VKey; import google.registry.persistence.WithStringVKey; import google.registry.schema.replay.DatastoreAndSqlEntity; @@ -170,7 +170,7 @@ public class ContactResource extends EppResource ContactAuthInfo authInfo; /** Data about any pending or past transfers on this contact. */ - TransferData transferData; + ContactTransferData transferData; /** * The time that this resource was last transferred. @@ -242,8 +242,8 @@ public class ContactResource extends EppResource } @Override - public final TransferData getTransferData() { - return Optional.ofNullable(transferData).orElse(TransferData.EMPTY); + public final ContactTransferData getTransferData() { + return Optional.ofNullable(transferData).orElse(ContactTransferData.EMPTY); } @Override @@ -285,7 +285,7 @@ public class ContactResource extends EppResource /** A builder for constructing {@link ContactResource}, since it is immutable. */ public static class Builder extends EppResource.Builder - implements BuilderWithTransferData { + implements BuilderWithTransferData { public Builder() {} @@ -350,7 +350,7 @@ public class ContactResource extends EppResource } @Override - public Builder setTransferData(TransferData transferData) { + public Builder setTransferData(ContactTransferData transferData) { getInstance().transferData = transferData; return this; } @@ -380,7 +380,7 @@ public class ContactResource extends EppResource public ContactResource build() { ContactResource instance = getInstance(); // If TransferData is totally empty, set it to null. - if (TransferData.EMPTY.equals(instance.transferData)) { + if (ContactTransferData.EMPTY.equals(instance.transferData)) { setTransferData(null); } // Set the searchName using the internationalized and localized postal info names. diff --git a/core/src/main/java/google/registry/model/domain/DomainBase.java b/core/src/main/java/google/registry/model/domain/DomainBase.java index 7b81397a8..7aa489ce1 100644 --- a/core/src/main/java/google/registry/model/domain/DomainBase.java +++ b/core/src/main/java/google/registry/model/domain/DomainBase.java @@ -63,7 +63,7 @@ import google.registry.model.eppcommon.StatusValue; import google.registry.model.host.HostResource; import google.registry.model.poll.PollMessage; import google.registry.model.registry.Registry; -import google.registry.model.transfer.TransferData; +import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.TransferStatus; import google.registry.persistence.VKey; import google.registry.persistence.WithStringVKey; @@ -110,7 +110,9 @@ import org.joda.time.Interval; @WithStringVKey @ExternalMessagingName("domain") public class DomainBase extends EppResource - implements DatastoreAndSqlEntity, ForeignKeyedEppResource, ResourceWithTransferData { + implements DatastoreAndSqlEntity, + ForeignKeyedEppResource, + ResourceWithTransferData { /** The max number of years that a domain can be registered for, as set by ICANN policy. */ public static final int MAX_REGISTRATION_YEARS = 10; @@ -253,7 +255,7 @@ public class DomainBase extends EppResource String smdId; /** Data about any pending or past transfers on this domain. */ - TransferData transferData; + DomainTransferData transferData; /** * The time that this resource was last transferred. @@ -322,8 +324,8 @@ public class DomainBase extends EppResource } @Override - public TransferData getTransferData() { - return Optional.ofNullable(transferData).orElse(TransferData.EMPTY); + public DomainTransferData getTransferData() { + return Optional.ofNullable(transferData).orElse(DomainTransferData.EMPTY); } @Override @@ -402,7 +404,7 @@ public class DomainBase extends EppResource @Override public DomainBase cloneProjectedAtTime(final DateTime now) { - TransferData transferData = getTransferData(); + DomainTransferData transferData = getTransferData(); DateTime transferExpirationTime = transferData.getPendingTransferExpirationTime(); // If there's a pending transfer that has expired, handle it. @@ -644,7 +646,7 @@ public class DomainBase extends EppResource /** A builder for constructing {@link DomainBase}, since it is immutable. */ public static class Builder extends EppResource.Builder - implements BuilderWithTransferData { + implements BuilderWithTransferData { public Builder() {} @@ -656,7 +658,7 @@ public class DomainBase extends EppResource public DomainBase build() { DomainBase instance = getInstance(); // If TransferData is totally empty, set it to null. - if (TransferData.EMPTY.equals(getInstance().transferData)) { + if (DomainTransferData.EMPTY.equals(getInstance().transferData)) { setTransferData(null); } // A DomainBase has status INACTIVE if there are no nameservers. @@ -830,7 +832,7 @@ public class DomainBase extends EppResource } @Override - public Builder setTransferData(TransferData transferData) { + public Builder setTransferData(DomainTransferData transferData) { getInstance().transferData = transferData; return thisCastToDerived(); } diff --git a/core/src/main/java/google/registry/model/transfer/BaseTransferObject.java b/core/src/main/java/google/registry/model/transfer/BaseTransferObject.java index a6e2f1939..98ce0eda4 100644 --- a/core/src/main/java/google/registry/model/transfer/BaseTransferObject.java +++ b/core/src/main/java/google/registry/model/transfer/BaseTransferObject.java @@ -121,5 +121,10 @@ public abstract class BaseTransferObject extends ImmutableObject { getInstance().pendingTransferExpirationTime = pendingTransferExpirationTime; return thisCastToDerived(); } + + @Override + public T build() { + return super.build(); + } } } diff --git a/core/src/main/java/google/registry/model/transfer/ContactTransferData.java b/core/src/main/java/google/registry/model/transfer/ContactTransferData.java new file mode 100644 index 000000000..7da7ccb9b --- /dev/null +++ b/core/src/main/java/google/registry/model/transfer/ContactTransferData.java @@ -0,0 +1,48 @@ +// 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. + +package google.registry.model.transfer; + +import com.googlecode.objectify.annotation.Embed; +import com.googlecode.objectify.annotation.Unindex; +import javax.persistence.Embeddable; + +/** Transfer data for contact. */ +@Embed +@Unindex +@Embeddable +public class ContactTransferData extends TransferData { + public static final ContactTransferData EMPTY = new ContactTransferData(); + + @Override + public boolean isEmpty() { + return EMPTY.equals(this); + } + + @Override + public Builder asBuilder() { + return new Builder(clone(this)); + } + + public static class Builder + extends TransferData.Builder { + /** Create a {@link ContactTransferData.Builder} wrapping a new instance. */ + public Builder() {} + + /** Create a {@link ContactTransferData.Builder} wrapping the given instance. */ + private Builder(ContactTransferData instance) { + super(instance); + } + } +} diff --git a/core/src/main/java/google/registry/model/transfer/DomainTransferData.java b/core/src/main/java/google/registry/model/transfer/DomainTransferData.java new file mode 100644 index 000000000..6e3190087 --- /dev/null +++ b/core/src/main/java/google/registry/model/transfer/DomainTransferData.java @@ -0,0 +1,186 @@ +// 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. + +package google.registry.model.transfer; + +import com.googlecode.objectify.annotation.Embed; +import com.googlecode.objectify.annotation.Ignore; +import com.googlecode.objectify.annotation.IgnoreSave; +import com.googlecode.objectify.annotation.Unindex; +import com.googlecode.objectify.condition.IfNull; +import google.registry.model.billing.BillingEvent; +import google.registry.model.domain.Period; +import google.registry.model.domain.Period.Unit; +import google.registry.model.poll.PollMessage; +import google.registry.persistence.VKey; +import javax.annotation.Nullable; +import javax.persistence.AttributeOverride; +import javax.persistence.AttributeOverrides; +import javax.persistence.Column; +import javax.persistence.Embeddable; +import javax.persistence.Embedded; +import org.joda.time.DateTime; + +/** Transfer data for domain. */ +@Embed +@Unindex +@Embeddable +public class DomainTransferData extends TransferData { + public static final DomainTransferData EMPTY = new DomainTransferData(); + + /** + * The period to extend the registration upon completion of the transfer. + * + *

By default, domain transfers are for one year. This can be changed to zero by using the + * superuser EPP extension. + */ + @Embedded + @AttributeOverrides({ + @AttributeOverride(name = "unit", column = @Column(name = "transfer_renew_period_unit")), + @AttributeOverride(name = "value", column = @Column(name = "transfer_renew_period_value")) + }) + Period transferPeriod = Period.create(1, Unit.YEARS); + + /** + * The registration expiration time resulting from the approval - speculative or actual - of the + * most recent transfer request, applicable for domains only. + * + *

For pending transfers, this is the expiration time that will take effect under a projected + * server approval. For approved transfers, this is the actual expiration time of the domain as of + * the moment of transfer completion. For rejected or cancelled transfers, this field will be + * reset to null. + * + *

Note that even when this field is set, it does not necessarily mean that the post-transfer + * domain has a new expiration time. Superuser transfers may not include a bundled 1 year renewal + * at all, or even when a renewal is bundled, for a transfer during the autorenew grace period the + * bundled renewal simply subsumes the recent autorenewal, resulting in the same expiration time. + */ + // TODO(b/36405140): backfill this field for existing domains to which it should apply. + @Column(name = "transfer_registration_expiration_time") + DateTime transferredRegistrationExpirationTime; + + @Ignore + @Column(name = "transfer_billing_cancellation_id") + Long billingCancellationId; + + /** + * The regular one-time billing event that will be charged for a server-approved transfer. + * + *

This field should be null if there is not currently a pending transfer or if the object + * being transferred is not a domain. + * + *

TODO(b/158230654) Remove unused columns for TransferData in Contact table. + */ + @IgnoreSave(IfNull.class) + @Column(name = "transfer_billing_event_id") + VKey serverApproveBillingEvent; + + /** + * The autorenew billing event that should be associated with this resource after the transfer. + * + *

This field should be null if there is not currently a pending transfer or if the object + * being transferred is not a domain. + */ + @IgnoreSave(IfNull.class) + @Column(name = "transfer_billing_recurrence_id") + VKey serverApproveAutorenewEvent; + + /** + * The autorenew poll message that should be associated with this resource after the transfer. + * + *

This field should be null if there is not currently a pending transfer or if the object + * being transferred is not a domain. + */ + @IgnoreSave(IfNull.class) + @Column(name = "transfer_autorenew_poll_message_id") + VKey serverApproveAutorenewPollMessage; + + @Override + public Builder copyConstantFieldsToBuilder() { + return super.copyConstantFieldsToBuilder().setTransferPeriod(this.transferPeriod); + } + + public Period getTransferPeriod() { + return transferPeriod; + } + + @Nullable + public DateTime getTransferredRegistrationExpirationTime() { + return transferredRegistrationExpirationTime; + } + + @Nullable + public VKey getServerApproveBillingEvent() { + return serverApproveBillingEvent; + } + + @Nullable + public VKey getServerApproveAutorenewEvent() { + return serverApproveAutorenewEvent; + } + + @Nullable + public VKey getServerApproveAutorenewPollMessage() { + return serverApproveAutorenewPollMessage; + } + + @Override + public boolean isEmpty() { + return EMPTY.equals(this); + } + + @Override + public Builder asBuilder() { + return new Builder(clone(this)); + } + + public static class Builder extends TransferData.Builder { + /** Create a {@link DomainTransferData.Builder} wrapping a new instance. */ + public Builder() {} + + /** Create a {@link Builder} wrapping the given instance. */ + private Builder(DomainTransferData instance) { + super(instance); + } + + public Builder setTransferPeriod(Period transferPeriod) { + getInstance().transferPeriod = transferPeriod; + return this; + } + + public Builder setTransferredRegistrationExpirationTime( + DateTime transferredRegistrationExpirationTime) { + getInstance().transferredRegistrationExpirationTime = transferredRegistrationExpirationTime; + return this; + } + + public Builder setServerApproveBillingEvent( + VKey serverApproveBillingEvent) { + getInstance().serverApproveBillingEvent = serverApproveBillingEvent; + return this; + } + + public Builder setServerApproveAutorenewEvent( + VKey serverApproveAutorenewEvent) { + getInstance().serverApproveAutorenewEvent = serverApproveAutorenewEvent; + return this; + } + + public Builder setServerApproveAutorenewPollMessage( + VKey serverApproveAutorenewPollMessage) { + getInstance().serverApproveAutorenewPollMessage = serverApproveAutorenewPollMessage; + return this; + } + } +} diff --git a/core/src/main/java/google/registry/model/transfer/TransferData.java b/core/src/main/java/google/registry/model/transfer/TransferData.java index 442bebbfc..772f98046 100644 --- a/core/src/main/java/google/registry/model/transfer/TransferData.java +++ b/core/src/main/java/google/registry/model/transfer/TransferData.java @@ -17,38 +17,31 @@ package google.registry.model.transfer; import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy; import com.google.common.collect.ImmutableSet; -import com.googlecode.objectify.annotation.Embed; import com.googlecode.objectify.annotation.Ignore; import com.googlecode.objectify.annotation.IgnoreSave; -import com.googlecode.objectify.annotation.Unindex; import com.googlecode.objectify.condition.IfNull; import google.registry.model.Buildable; import google.registry.model.EppResource; -import google.registry.model.billing.BillingEvent; -import google.registry.model.domain.Period; -import google.registry.model.domain.Period.Unit; import google.registry.model.eppcommon.Trid; -import google.registry.model.poll.PollMessage; import google.registry.persistence.VKey; +import google.registry.util.TypeUtils.TypeInstantiator; import java.util.Set; import javax.annotation.Nullable; import javax.persistence.AttributeOverride; import javax.persistence.AttributeOverrides; import javax.persistence.Column; import javax.persistence.Embedded; +import javax.persistence.MappedSuperclass; import javax.persistence.Transient; -import org.joda.time.DateTime; /** * Common transfer data for {@link EppResource} types. Only applies to domains and contacts; hosts * are implicitly transferred with their superordinate domain. */ -@Embed -@Unindex -@javax.persistence.Embeddable -public class TransferData extends BaseTransferObject implements Buildable { - - public static final TransferData EMPTY = new TransferData(); +@MappedSuperclass +public abstract class TransferData< + B extends TransferData.Builder> + extends BaseTransferObject implements Buildable { /** The transaction id of the most recent transfer request (or null if there never was one). */ @Embedded @@ -62,37 +55,6 @@ public class TransferData extends BaseTransferObject implements Buildable { }) Trid transferRequestTrid; - /** - * The period to extend the registration upon completion of the transfer. - * - *

By default, domain transfers are for one year. This can be changed to zero by using the - * superuser EPP extension. - */ - @Embedded - @AttributeOverrides({ - @AttributeOverride(name = "unit", column = @Column(name = "transfer_renew_period_unit")), - @AttributeOverride(name = "value", column = @Column(name = "transfer_renew_period_value")) - }) - Period transferPeriod = Period.create(1, Unit.YEARS); - - /** - * The registration expiration time resulting from the approval - speculative or actual - of the - * most recent transfer request, applicable for domains only. - * - *

For pending transfers, this is the expiration time that will take effect under a projected - * server approval. For approved transfers, this is the actual expiration time of the domain as of - * the moment of transfer completion. For rejected or cancelled transfers, this field will be - * reset to null. - * - *

Note that even when this field is set, it does not necessarily mean that the post-transfer - * domain has a new expiration time. Superuser transfers may not include a bundled 1 year renewal - * at all, or even when a renewal is bundled, for a transfer during the autorenew grace period the - * bundled renewal simply subsumes the recent autorenewal, resulting in the same expiration time. - */ - // TODO(b/36405140): backfill this field for existing domains to which it should apply. - @Column(name = "transfer_registration_expiration_time") - DateTime transferredRegistrationExpirationTime; - /** * The billing event and poll messages associated with a server-approved transfer. * @@ -116,85 +78,26 @@ public class TransferData extends BaseTransferObject implements Buildable { @Column(name = "transfer_losing_poll_message_id") Long losingTransferPollMessageId; - @Ignore - @Column(name = "transfer_billing_cancellation_id") - Long billingCancellationId; - - /** - * The regular one-time billing event that will be charged for a server-approved transfer. - * - *

This field should be null if there is not currently a pending transfer or if the object - * being transferred is not a domain. - * - *

TODO(b/158230654) Remove unused columns for TransferData in Contact table. - */ - @IgnoreSave(IfNull.class) - @Column(name = "transfer_billing_event_id") - VKey serverApproveBillingEvent; - - /** - * The autorenew billing event that should be associated with this resource after the transfer. - * - *

This field should be null if there is not currently a pending transfer or if the object - * being transferred is not a domain. - */ - @IgnoreSave(IfNull.class) - @Column(name = "transfer_billing_recurrence_id") - VKey serverApproveAutorenewEvent; - - /** - * The autorenew poll message that should be associated with this resource after the transfer. - * - *

This field should be null if there is not currently a pending transfer or if the object - * being transferred is not a domain. - */ - @IgnoreSave(IfNull.class) - @Column(name = "transfer_autorenew_poll_message_id") - VKey serverApproveAutorenewPollMessage; + public abstract boolean isEmpty(); @Nullable public Trid getTransferRequestTrid() { return transferRequestTrid; } - public Period getTransferPeriod() { - return transferPeriod; - } - - @Nullable - public DateTime getTransferredRegistrationExpirationTime() { - return transferredRegistrationExpirationTime; - } - public ImmutableSet> getServerApproveEntities() { return nullToEmptyImmutableCopy(serverApproveEntities); } - @Nullable - public VKey getServerApproveBillingEvent() { - return serverApproveBillingEvent; - } - - @Nullable - public VKey getServerApproveAutorenewEvent() { - return serverApproveAutorenewEvent; - } - - @Nullable - public VKey getServerApproveAutorenewPollMessage() { - return serverApproveAutorenewPollMessage; - } - @Override - public Builder asBuilder() { - return new Builder(clone(this)); - } + public abstract Builder asBuilder(); /** * Returns a fresh Builder populated only with the constant fields of this TransferData, i.e. * those that are fixed and unchanging throughout the transfer process. * *

These fields are: + * *

    *
  • transferRequestTrid *
  • transferRequestTime @@ -203,64 +106,43 @@ public class TransferData extends BaseTransferObject implements Buildable { *
  • transferPeriod *
*/ - public Builder copyConstantFieldsToBuilder() { - return new Builder() + public B copyConstantFieldsToBuilder() { + B newBuilder = new TypeInstantiator(getClass()) {}.instantiate(); + newBuilder + // .setTransferPeriod(this.transferPeriod) .setTransferRequestTrid(this.transferRequestTrid) .setTransferRequestTime(this.transferRequestTime) .setGainingClientId(this.gainingClientId) - .setLosingClientId(this.losingClientId) - .setTransferPeriod(this.transferPeriod); + .setLosingClientId(this.losingClientId); + return newBuilder; } /** Builder for {@link TransferData} because it is immutable. */ - public static class Builder extends BaseTransferObject.Builder { + public abstract static class Builder> + extends BaseTransferObject.Builder { /** Create a {@link Builder} wrapping a new instance. */ public Builder() {} /** Create a {@link Builder} wrapping the given instance. */ - private Builder(TransferData instance) { + protected Builder(T instance) { super(instance); } - public Builder setTransferRequestTrid(Trid transferRequestTrid) { + public B setTransferRequestTrid(Trid transferRequestTrid) { getInstance().transferRequestTrid = transferRequestTrid; - return this; + return thisCastToDerived(); } - public Builder setTransferPeriod(Period transferPeriod) { - getInstance().transferPeriod = transferPeriod; - return this; - } - - public Builder setTransferredRegistrationExpirationTime( - DateTime transferredRegistrationExpirationTime) { - getInstance().transferredRegistrationExpirationTime = transferredRegistrationExpirationTime; - return this; - } - - public Builder setServerApproveEntities( + public B setServerApproveEntities( ImmutableSet> serverApproveEntities) { getInstance().serverApproveEntities = serverApproveEntities; - return this; + return thisCastToDerived(); } - public Builder setServerApproveBillingEvent( - VKey serverApproveBillingEvent) { - getInstance().serverApproveBillingEvent = serverApproveBillingEvent; - return this; - } - - public Builder setServerApproveAutorenewEvent( - VKey serverApproveAutorenewEvent) { - getInstance().serverApproveAutorenewEvent = serverApproveAutorenewEvent; - return this; - } - - public Builder setServerApproveAutorenewPollMessage( - VKey serverApproveAutorenewPollMessage) { - getInstance().serverApproveAutorenewPollMessage = serverApproveAutorenewPollMessage; - return this; + @Override + public T build() { + return super.build(); } } diff --git a/core/src/main/java/google/registry/rde/ContactResourceToXjcConverter.java b/core/src/main/java/google/registry/rde/ContactResourceToXjcConverter.java index 53bb40fcf..255568f31 100644 --- a/core/src/main/java/google/registry/rde/ContactResourceToXjcConverter.java +++ b/core/src/main/java/google/registry/rde/ContactResourceToXjcConverter.java @@ -36,7 +36,6 @@ import google.registry.xjc.eppcom.XjcEppcomTrStatusType; import google.registry.xjc.rdecontact.XjcRdeContact; import google.registry.xjc.rdecontact.XjcRdeContactElement; import google.registry.xjc.rdecontact.XjcRdeContactTransferDataType; -import java.util.Objects; import javax.annotation.CheckForNull; import javax.annotation.Nullable; @@ -102,7 +101,7 @@ final class ContactResourceToXjcConverter { // required before an automated response action will be taken by // the registry. For all other status types, the value identifies // the date and time when the request was completed. - if (!Objects.equals(model.getTransferData(), TransferData.EMPTY)) { + if (!model.getTransferData().isEmpty()) { bean.setTrnData(convertTransferData(model.getTransferData())); } diff --git a/core/src/main/java/google/registry/rde/DomainBaseToXjcConverter.java b/core/src/main/java/google/registry/rde/DomainBaseToXjcConverter.java index 0942ebc61..def9708e8 100644 --- a/core/src/main/java/google/registry/rde/DomainBaseToXjcConverter.java +++ b/core/src/main/java/google/registry/rde/DomainBaseToXjcConverter.java @@ -28,6 +28,7 @@ import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.secdns.DelegationSignerData; import google.registry.model.eppcommon.StatusValue; import google.registry.model.rde.RdeMode; +import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.TransferData; import google.registry.persistence.VKey; import google.registry.util.Idn; @@ -234,7 +235,7 @@ final class DomainBaseToXjcConverter { // * An OPTIONAL element that contains the end of the // domain name object's validity period (expiry date) if the // transfer caused or causes a change in the validity period. - if (!model.getTransferData().equals(TransferData.EMPTY)) { + if (!model.getTransferData().isEmpty()) { // Temporary check to make sure that there really was a transfer. A bug caused spurious // empty transfer records to get generated for deleted domains. // TODO(b/33289763): remove the hasGainingAndLosingRegistrars check in February 2017 @@ -258,7 +259,7 @@ final class DomainBaseToXjcConverter { } /** Converts {@link TransferData} to {@link XjcRdeDomainTransferDataType}. */ - private static XjcRdeDomainTransferDataType convertTransferData(TransferData model) { + private static XjcRdeDomainTransferDataType convertTransferData(DomainTransferData model) { XjcRdeDomainTransferDataType bean = new XjcRdeDomainTransferDataType(); bean.setTrStatus( XjcEppcomTrStatusType.fromValue(model.getTransferStatus().getXmlName())); diff --git a/core/src/test/java/google/registry/batch/DeleteContactsAndHostsActionTest.java b/core/src/test/java/google/registry/batch/DeleteContactsAndHostsActionTest.java index 1ec8e6b37..1e91090f6 100644 --- a/core/src/test/java/google/registry/batch/DeleteContactsAndHostsActionTest.java +++ b/core/src/test/java/google/registry/batch/DeleteContactsAndHostsActionTest.java @@ -87,6 +87,7 @@ import google.registry.model.poll.PollMessage.OneTime; import google.registry.model.registry.Registry; import google.registry.model.reporting.HistoryEntry; import google.registry.model.server.Lock; +import google.registry.model.transfer.ContactTransferData; import google.registry.model.transfer.TransferData; import google.registry.model.transfer.TransferResponse; import google.registry.model.transfer.TransferStatus; @@ -303,7 +304,7 @@ public class DeleteContactsAndHostsActionTest false); runMapreduce(); ContactResource contactAfterDeletion = ofy().load().entity(contact).now(); - assertThat(contactAfterDeletion.getTransferData()).isEqualTo(TransferData.EMPTY); + assertThat(contactAfterDeletion.getTransferData()).isEqualTo(ContactTransferData.EMPTY); } @Test diff --git a/core/src/test/java/google/registry/flows/contact/ContactTransferRequestFlowTest.java b/core/src/test/java/google/registry/flows/contact/ContactTransferRequestFlowTest.java index bcc0dbaec..f47d90087 100644 --- a/core/src/test/java/google/registry/flows/contact/ContactTransferRequestFlowTest.java +++ b/core/src/test/java/google/registry/flows/contact/ContactTransferRequestFlowTest.java @@ -43,14 +43,12 @@ import google.registry.flows.exceptions.ObjectAlreadySponsoredException; import google.registry.flows.exceptions.ResourceStatusProhibitsOperationException; import google.registry.model.contact.ContactAuthInfo; import google.registry.model.contact.ContactResource; -import google.registry.model.domain.Period; -import google.registry.model.domain.Period.Unit; import google.registry.model.eppcommon.AuthInfo.PasswordAuth; import google.registry.model.eppcommon.StatusValue; import google.registry.model.eppcommon.Trid; import google.registry.model.poll.PollMessage; import google.registry.model.reporting.HistoryEntry; -import google.registry.model.transfer.TransferData; +import google.registry.model.transfer.ContactTransferData; import google.registry.model.transfer.TransferStatus; import google.registry.persistence.VKey; import org.joda.time.DateTime; @@ -95,13 +93,11 @@ public class ContactTransferRequestFlowTest contact.getTransferData().getTransferRequestTrid().getServerTransactionId()); assertThat(contact.getTransferData()) .isEqualTo( - new TransferData.Builder() + new ContactTransferData.Builder() .setTransferRequestTrid(expectedTrid) .setTransferRequestTime(clock.nowUtc()) .setGainingClientId("NewRegistrar") .setLosingClientId("TheRegistrar") - // Period is meaningless for contact transfers, but this is the default. - .setTransferPeriod(Period.create(1, Unit.YEARS)) .setTransferStatus(TransferStatus.PENDING) .setPendingTransferExpirationTime(afterTransfer) // Make the server-approve entities field a no-op comparison; it's easier to diff --git a/core/src/test/java/google/registry/flows/domain/DomainDeleteFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainDeleteFlowTest.java index 88f6c8398..3341f2b68 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainDeleteFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainDeleteFlowTest.java @@ -90,7 +90,7 @@ import google.registry.model.registry.Registry; import google.registry.model.registry.Registry.TldType; import google.registry.model.reporting.DomainTransactionRecord; import google.registry.model.reporting.HistoryEntry; -import google.registry.model.transfer.TransferData; +import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.TransferResponse; import google.registry.model.transfer.TransferStatus; import google.registry.persistence.VKey; @@ -595,7 +595,7 @@ public class DomainDeleteFlowTest extends ResourceFlowTestCase> serverApproveEntities; + org.joda.time.DateTime pendingTransferExpirationTime; + org.joda.time.DateTime transferRequestTime; +} +class google.registry.model.transfer.DomainTransferData { google.registry.model.domain.Period transferPeriod; google.registry.model.eppcommon.Trid transferRequestTrid; google.registry.model.transfer.TransferStatus transferStatus; diff --git a/db/src/main/resources/sql/flyway/V32__drop_unused_transafer_data_columns_in_contact.sql b/db/src/main/resources/sql/flyway/V32__drop_unused_transafer_data_columns_in_contact.sql new file mode 100644 index 000000000..daef32daf --- /dev/null +++ b/db/src/main/resources/sql/flyway/V32__drop_unused_transafer_data_columns_in_contact.sql @@ -0,0 +1,21 @@ +-- 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. + +ALTER TABLE "Contact" DROP COLUMN transfer_billing_cancellation_id; +ALTER TABLE "Contact" DROP COLUMN transfer_billing_recurrence_id; +ALTER TABLE "Contact" DROP COLUMN transfer_autorenew_poll_message_id; +ALTER TABLE "Contact" DROP COLUMN transfer_billing_event_id; +ALTER TABLE "Contact" DROP COLUMN transfer_renew_period_unit; +ALTER TABLE "Contact" DROP COLUMN transfer_renew_period_value; +ALTER TABLE "Contact" DROP COLUMN transfer_registration_expiration_time; 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 025f7c77e..66bb2f7ce 100644 --- a/db/src/main/resources/sql/schema/db-schema.sql.generated +++ b/db/src/main/resources/sql/schema/db-schema.sql.generated @@ -118,17 +118,10 @@ addr_local_org text, addr_local_type text, search_name text, - transfer_billing_cancellation_id int8, transfer_gaining_poll_message_id int8, transfer_losing_poll_message_id int8, - transfer_billing_recurrence_id int8, - transfer_autorenew_poll_message_id int8, - transfer_billing_event_id int8, - transfer_renew_period_unit text, - transfer_renew_period_value int4, transfer_client_txn_id text, transfer_server_txn_id text, - transfer_registration_expiration_time timestamptz, transfer_gaining_registrar_id text, transfer_losing_registrar_id text, transfer_pending_expiration_time timestamptz, @@ -182,16 +175,16 @@ tech_contact text, tld text, transfer_billing_cancellation_id int8, - transfer_gaining_poll_message_id int8, - transfer_losing_poll_message_id int8, transfer_billing_recurrence_id int8, transfer_autorenew_poll_message_id int8, transfer_billing_event_id int8, transfer_renew_period_unit text, transfer_renew_period_value int4, + transfer_registration_expiration_time timestamptz, + transfer_gaining_poll_message_id int8, + transfer_losing_poll_message_id int8, transfer_client_txn_id text, transfer_server_txn_id text, - transfer_registration_expiration_time timestamptz, transfer_gaining_registrar_id text, transfer_losing_registrar_id text, transfer_pending_expiration_time timestamptz, diff --git a/db/src/main/resources/sql/schema/nomulus.golden.sql b/db/src/main/resources/sql/schema/nomulus.golden.sql index 2be29e7ae..2b2905e1a 100644 --- a/db/src/main/resources/sql/schema/nomulus.golden.sql +++ b/db/src/main/resources/sql/schema/nomulus.golden.sql @@ -244,15 +244,8 @@ CREATE TABLE public."Contact" ( voice_phone_number text, transfer_gaining_poll_message_id bigint, transfer_losing_poll_message_id bigint, - transfer_billing_cancellation_id bigint, - transfer_billing_event_id bigint, - transfer_billing_recurrence_id bigint, - transfer_autorenew_poll_message_id bigint, - transfer_renew_period_unit text, - transfer_renew_period_value integer, transfer_client_txn_id text, transfer_server_txn_id text, - transfer_registration_expiration_time timestamp with time zone, transfer_gaining_registrar_id text, transfer_losing_registrar_id text, transfer_pending_expiration_time timestamp with time zone,