diff --git a/core/src/main/java/google/registry/model/BackupGroupRoot.java b/core/src/main/java/google/registry/model/BackupGroupRoot.java index 9334cc0ea..4c05be52a 100644 --- a/core/src/main/java/google/registry/model/BackupGroupRoot.java +++ b/core/src/main/java/google/registry/model/BackupGroupRoot.java @@ -16,6 +16,8 @@ package google.registry.model; import javax.persistence.Access; import javax.persistence.AccessType; +import javax.persistence.AttributeOverride; +import javax.persistence.Column; import javax.persistence.MappedSuperclass; import javax.xml.bind.annotation.XmlTransient; @@ -40,6 +42,7 @@ public abstract class BackupGroupRoot extends ImmutableObject { // Prevents subclasses from unexpectedly accessing as property (e.g., HostResource), which would // require an unnecessary non-private setter method. @Access(AccessType.FIELD) + @AttributeOverride(name = "lastUpdateTime", column = @Column(name = "updateTimestamp")) UpdateAutoTimestamp updateTimestamp = UpdateAutoTimestamp.create(null); /** Get the {@link UpdateAutoTimestamp} for this entity. */ diff --git a/core/src/main/java/google/registry/model/UpdateAutoTimestamp.java b/core/src/main/java/google/registry/model/UpdateAutoTimestamp.java index dd75ad7ec..7c3080d7c 100644 --- a/core/src/main/java/google/registry/model/UpdateAutoTimestamp.java +++ b/core/src/main/java/google/registry/model/UpdateAutoTimestamp.java @@ -14,11 +14,22 @@ package google.registry.model; +import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm; import static google.registry.util.DateTimeUtils.START_OF_TIME; +import com.googlecode.objectify.annotation.Ignore; +import com.googlecode.objectify.annotation.OnLoad; import google.registry.model.translators.UpdateAutoTimestampTranslatorFactory; +import google.registry.util.DateTimeUtils; +import java.time.ZonedDateTime; import java.util.Optional; import javax.annotation.Nullable; +import javax.persistence.Column; +import javax.persistence.Embeddable; +import javax.persistence.PostLoad; +import javax.persistence.PrePersist; +import javax.persistence.PreUpdate; +import javax.persistence.Transient; import org.joda.time.DateTime; /** @@ -26,14 +37,44 @@ import org.joda.time.DateTime; * * @see UpdateAutoTimestampTranslatorFactory */ +@Embeddable public class UpdateAutoTimestamp extends ImmutableObject { - // When set to true, database converters/translators should do tha auto update. When set to + // When set to true, database converters/translators should do the auto update. When set to // false, auto update should be suspended (this exists to allow us to preserve the original value // during a replay). private static ThreadLocal autoUpdateEnabled = ThreadLocal.withInitial(() -> true); - DateTime timestamp; + @Transient DateTime timestamp; + + @Ignore + @Column(nullable = false) + ZonedDateTime lastUpdateTime; + + // Unfortunately, we cannot use the @UpdateTimestamp annotation on "lastUpdateTime" in this class + // because Hibernate does not allow it to be used on @Embeddable classes, see + // https://hibernate.atlassian.net/browse/HHH-13235. This is a workaround. + @PrePersist + @PreUpdate + void setTimestamp() { + if (autoUpdateEnabled() || lastUpdateTime == null) { + lastUpdateTime = DateTimeUtils.toZonedDateTime(jpaTm().getTransactionTime()); + } + } + + @OnLoad + void onLoad() { + if (timestamp != null) { + lastUpdateTime = DateTimeUtils.toZonedDateTime(timestamp); + } + } + + @PostLoad + void postLoad() { + if (lastUpdateTime != null) { + timestamp = DateTimeUtils.toJodaDateTime(lastUpdateTime); + } + } /** Returns the timestamp, or {@code START_OF_TIME} if it's null. */ public DateTime getTimestamp() { @@ -43,6 +84,7 @@ public class UpdateAutoTimestamp extends ImmutableObject { public static UpdateAutoTimestamp create(@Nullable DateTime timestamp) { UpdateAutoTimestamp instance = new UpdateAutoTimestamp(); instance.timestamp = timestamp; + instance.lastUpdateTime = timestamp == null ? null : DateTimeUtils.toZonedDateTime(timestamp); return instance; } diff --git a/core/src/main/java/google/registry/model/registry/RegistryLockDao.java b/core/src/main/java/google/registry/model/registry/RegistryLockDao.java index 07afbcbb2..d69b8c324 100644 --- a/core/src/main/java/google/registry/model/registry/RegistryLockDao.java +++ b/core/src/main/java/google/registry/model/registry/RegistryLockDao.java @@ -51,10 +51,8 @@ public final class RegistryLockDao { return ImmutableList.copyOf( jpaTm() .query( - "SELECT lock FROM RegistryLock lock" - + " WHERE lock.registrarId = :registrarId" - + " AND lock.unlockCompletionTimestamp IS NULL" - + " ORDER BY lock.domainName ASC", + "SELECT lock FROM RegistryLock lock WHERE lock.registrarId = :registrarId" + + " AND lock.unlockCompletionTime IS NULL ORDER BY lock.domainName ASC", RegistryLock.class) .setParameter("registrarId", registrarId) .getResultList()); @@ -89,9 +87,8 @@ public final class RegistryLockDao { return jpaTm() .query( "SELECT lock FROM RegistryLock lock WHERE lock.repoId = :repoId AND" - + " lock.lockCompletionTimestamp IS NOT NULL AND" - + " lock.unlockCompletionTimestamp IS NULL ORDER BY lock.revisionId" - + " DESC", + + " lock.lockCompletionTime IS NOT NULL AND lock.unlockCompletionTime IS NULL" + + " ORDER BY lock.revisionId DESC", RegistryLock.class) .setParameter("repoId", repoId) .setMaxResults(1) @@ -110,8 +107,7 @@ public final class RegistryLockDao { return jpaTm() .query( "SELECT lock FROM RegistryLock lock WHERE lock.repoId = :repoId AND" - + " lock.unlockCompletionTimestamp IS NOT NULL ORDER BY lock.revisionId" - + " DESC", + + " lock.unlockCompletionTime IS NOT NULL ORDER BY lock.revisionId DESC", RegistryLock.class) .setParameter("repoId", repoId) .setMaxResults(1) diff --git a/core/src/main/java/google/registry/persistence/converter/UpdateAutoTimestampConverter.java b/core/src/main/java/google/registry/persistence/converter/UpdateAutoTimestampConverter.java deleted file mode 100644 index ebd709693..000000000 --- a/core/src/main/java/google/registry/persistence/converter/UpdateAutoTimestampConverter.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2019 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.persistence.converter; - -import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm; - -import google.registry.model.UpdateAutoTimestamp; -import google.registry.util.DateTimeUtils; -import java.sql.Timestamp; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import javax.annotation.Nullable; -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; - -/** JPA converter for storing/retrieving UpdateAutoTimestamp objects. */ -@Converter(autoApply = true) -public class UpdateAutoTimestampConverter - implements AttributeConverter { - - @Override - public Timestamp convertToDatabaseColumn(UpdateAutoTimestamp entity) { - return Timestamp.from( - DateTimeUtils.toZonedDateTime( - UpdateAutoTimestamp.autoUpdateEnabled() - || entity == null - || entity.getTimestamp() == null - ? jpaTm().getTransactionTime() - : entity.getTimestamp()) - .toInstant()); - } - - @Override - @Nullable - public UpdateAutoTimestamp convertToEntityAttribute(@Nullable Timestamp columnValue) { - if (columnValue == null) { - return null; - } - ZonedDateTime zdt = ZonedDateTime.ofInstant(columnValue.toInstant(), ZoneOffset.UTC); - return UpdateAutoTimestamp.create(DateTimeUtils.toJodaDateTime(zdt)); - } -} diff --git a/core/src/main/java/google/registry/schema/domain/RegistryLock.java b/core/src/main/java/google/registry/schema/domain/RegistryLock.java index 9987893f3..032156c43 100644 --- a/core/src/main/java/google/registry/schema/domain/RegistryLock.java +++ b/core/src/main/java/google/registry/schema/domain/RegistryLock.java @@ -102,22 +102,22 @@ public final class RegistryLock extends ImmutableObject implements Buildable, Sq /** When the lock is first requested. */ @Column(nullable = false) - private CreateAutoTimestamp lockRequestTimestamp = CreateAutoTimestamp.create(null); + private CreateAutoTimestamp lockRequestTime = CreateAutoTimestamp.create(null); /** When the unlock is first requested. */ - private ZonedDateTime unlockRequestTimestamp; + private ZonedDateTime unlockRequestTime; /** * When the user has verified the lock. If this field is null, it means the lock has not been * verified yet (and thus not been put into effect). */ - private ZonedDateTime lockCompletionTimestamp; + private ZonedDateTime lockCompletionTime; /** * When the user has verified the unlock of this lock. If this field is null, it means the unlock * action has not been verified yet (and has not been put into effect). */ - private ZonedDateTime unlockCompletionTimestamp; + private ZonedDateTime unlockCompletionTime; /** The user must provide the random verification code in order to complete the action. */ @Column(nullable = false) @@ -140,7 +140,7 @@ public final class RegistryLock extends ImmutableObject implements Buildable, Sq private Duration relockDuration; /** Time that this entity was last updated. */ - private UpdateAutoTimestamp lastUpdateTimestamp; + private UpdateAutoTimestamp lastUpdateTime = UpdateAutoTimestamp.create(null); public String getRepoId() { return repoId; @@ -158,25 +158,25 @@ public final class RegistryLock extends ImmutableObject implements Buildable, Sq return registrarPocId; } - public DateTime getLockRequestTimestamp() { - return lockRequestTimestamp.getTimestamp(); + public DateTime getLockRequestTime() { + return lockRequestTime.getTimestamp(); } /** Returns the unlock request timestamp or null if an unlock has not been requested yet. */ - public Optional getUnlockRequestTimestamp() { - return Optional.ofNullable(unlockRequestTimestamp).map(DateTimeUtils::toJodaDateTime); + public Optional getUnlockRequestTime() { + return Optional.ofNullable(unlockRequestTime).map(DateTimeUtils::toJodaDateTime); } /** Returns the completion timestamp, or empty if this lock has not been completed yet. */ - public Optional getLockCompletionTimestamp() { - return Optional.ofNullable(lockCompletionTimestamp).map(DateTimeUtils::toJodaDateTime); + public Optional getLockCompletionTime() { + return Optional.ofNullable(lockCompletionTime).map(DateTimeUtils::toJodaDateTime); } /** * Returns the unlock completion timestamp, or empty if this unlock has not been completed yet. */ - public Optional getUnlockCompletionTimestamp() { - return Optional.ofNullable(unlockCompletionTimestamp).map(DateTimeUtils::toJodaDateTime); + public Optional getUnlockCompletionTime() { + return Optional.ofNullable(unlockCompletionTime).map(DateTimeUtils::toJodaDateTime); } public String getVerificationCode() { @@ -187,8 +187,8 @@ public final class RegistryLock extends ImmutableObject implements Buildable, Sq return isSuperuser; } - public DateTime getLastUpdateTimestamp() { - return lastUpdateTimestamp.getTimestamp(); + public DateTime getLastUpdateTime() { + return lastUpdateTime.getTimestamp(); } public Long getRevisionId() { @@ -211,20 +211,20 @@ public final class RegistryLock extends ImmutableObject implements Buildable, Sq } public boolean isLocked() { - return lockCompletionTimestamp != null && unlockCompletionTimestamp == null; + return lockCompletionTime != null && unlockCompletionTime == null; } /** Returns true iff the lock was requested >= 1 hour ago and has not been verified. */ public boolean isLockRequestExpired(DateTime now) { - return !getLockCompletionTimestamp().isPresent() - && isBeforeOrAt(getLockRequestTimestamp(), now.minusHours(1)); + return !getLockCompletionTime().isPresent() + && isBeforeOrAt(getLockRequestTime(), now.minusHours(1)); } /** Returns true iff the unlock was requested >= 1 hour ago and has not been verified. */ public boolean isUnlockRequestExpired(DateTime now) { - Optional unlockRequestTimestamp = getUnlockRequestTimestamp(); + Optional unlockRequestTimestamp = getUnlockRequestTime(); return unlockRequestTimestamp.isPresent() - && !getUnlockCompletionTimestamp().isPresent() + && !getUnlockCompletionTime().isPresent() && isBeforeOrAt(unlockRequestTimestamp.get(), now.minusHours(1)); } @@ -278,18 +278,18 @@ public final class RegistryLock extends ImmutableObject implements Buildable, Sq return this; } - public Builder setUnlockRequestTimestamp(DateTime unlockRequestTimestamp) { - getInstance().unlockRequestTimestamp = toZonedDateTime(unlockRequestTimestamp); + public Builder setUnlockRequestTime(DateTime unlockRequestTime) { + getInstance().unlockRequestTime = toZonedDateTime(unlockRequestTime); return this; } - public Builder setLockCompletionTimestamp(DateTime lockCompletionTimestamp) { - getInstance().lockCompletionTimestamp = toZonedDateTime(lockCompletionTimestamp); + public Builder setLockCompletionTime(DateTime lockCompletionTime) { + getInstance().lockCompletionTime = toZonedDateTime(lockCompletionTime); return this; } - public Builder setUnlockCompletionTimestamp(DateTime unlockCompletionTimestamp) { - getInstance().unlockCompletionTimestamp = toZonedDateTime(unlockCompletionTimestamp); + public Builder setUnlockCompletionTime(DateTime unlockCompletionTime) { + getInstance().unlockCompletionTime = toZonedDateTime(unlockCompletionTime); return this; } diff --git a/core/src/main/java/google/registry/tools/DomainLockUtils.java b/core/src/main/java/google/registry/tools/DomainLockUtils.java index f1cf8497e..7dcb7aad4 100644 --- a/core/src/main/java/google/registry/tools/DomainLockUtils.java +++ b/core/src/main/java/google/registry/tools/DomainLockUtils.java @@ -103,7 +103,7 @@ public final class DomainLockUtils { RegistryLock lock = getByVerificationCode(verificationCode); checkArgument( - !lock.getLockCompletionTimestamp().isPresent(), + !lock.getLockCompletionTime().isPresent(), "Domain %s is already locked", lock.getDomainName()); @@ -115,7 +115,7 @@ public final class DomainLockUtils { !lock.isSuperuser() || isAdmin, "Non-admin user cannot complete admin lock"); RegistryLock newLock = - RegistryLockDao.save(lock.asBuilder().setLockCompletionTimestamp(now).build()); + RegistryLockDao.save(lock.asBuilder().setLockCompletionTime(now).build()); setAsRelock(newLock); tm().transact(() -> applyLockStatuses(newLock, now, isAdmin)); return newLock; @@ -131,7 +131,7 @@ public final class DomainLockUtils { DateTime now = jpaTm().getTransactionTime(); RegistryLock previousLock = getByVerificationCode(verificationCode); checkArgument( - !previousLock.getUnlockCompletionTimestamp().isPresent(), + !previousLock.getUnlockCompletionTime().isPresent(), "Domain %s is already unlocked", previousLock.getDomainName()); @@ -145,7 +145,7 @@ public final class DomainLockUtils { RegistryLock newLock = RegistryLockDao.save( - previousLock.asBuilder().setUnlockCompletionTimestamp(now).build()); + previousLock.asBuilder().setUnlockCompletionTime(now).build()); tm().transact(() -> removeLockStatuses(newLock, isAdmin, now)); return newLock; }); @@ -169,7 +169,7 @@ public final class DomainLockUtils { RegistryLock newLock = RegistryLockDao.save( createLockBuilder(domainName, registrarId, registrarPocId, isAdmin) - .setLockCompletionTimestamp(now) + .setLockCompletionTime(now) .build()); tm().transact(() -> applyLockStatuses(newLock, now, isAdmin)); setAsRelock(newLock); @@ -192,7 +192,7 @@ public final class DomainLockUtils { RegistryLock result = RegistryLockDao.save( createUnlockBuilder(domainName, registrarId, isAdmin, relockDuration) - .setUnlockCompletionTimestamp(now) + .setUnlockCompletionTime(now) .build()); tm().transact(() -> removeLockStatuses(result, isAdmin, now)); return result; @@ -230,7 +230,7 @@ public final class DomainLockUtils { previousLock -> checkArgument( previousLock.isLockRequestExpired(now) - || previousLock.getUnlockCompletionTimestamp().isPresent() + || previousLock.getUnlockCompletionTime().isPresent() || isAdmin, "A pending or completed lock action already exists for %s", previousLock.getDomainName())); @@ -264,7 +264,7 @@ public final class DomainLockUtils { new RegistryLock.Builder() .setRepoId(domainBase.getRepoId()) .setDomainName(domainName) - .setLockCompletionTimestamp(now) + .setLockCompletionTime(now) .setRegistrarId(registrarId)); } else { RegistryLock lock = @@ -275,7 +275,7 @@ public final class DomainLockUtils { checkArgument( lock.isLocked(), "Lock object for domain %s is not currently locked", domainName); checkArgument( - !lock.getUnlockRequestTimestamp().isPresent() || lock.isUnlockRequestExpired(now), + !lock.getUnlockRequestTime().isPresent() || lock.isUnlockRequestExpired(now), "A pending unlock action already exists for %s", domainName); checkArgument( @@ -290,7 +290,7 @@ public final class DomainLockUtils { return newLockBuilder .setVerificationCode(stringGenerator.createString(VERIFICATION_CODE_LENGTH)) .isSuperuser(isAdmin) - .setUnlockRequestTimestamp(now) + .setUnlockRequestTime(now) .setRegistrarId(registrarId); } diff --git a/core/src/main/java/google/registry/tools/javascrap/BackfillRegistryLocksCommand.java b/core/src/main/java/google/registry/tools/javascrap/BackfillRegistryLocksCommand.java index 0fd1af1fe..dba4c1b6c 100644 --- a/core/src/main/java/google/registry/tools/javascrap/BackfillRegistryLocksCommand.java +++ b/core/src/main/java/google/registry/tools/javascrap/BackfillRegistryLocksCommand.java @@ -107,7 +107,7 @@ public class BackfillRegistryLocksCommand extends ConfirmingCommand .setRegistrarId(registryAdminClientId) .setRepoId(domainBase.getRepoId()) .setDomainName(domainBase.getDomainName()) - .setLockCompletionTimestamp( + .setLockCompletionTime( getLockCompletionTimestamp(domainBase, jpaTm().getTransactionTime())) .setVerificationCode( stringGenerator.createString(VERIFICATION_CODE_LENGTH)) diff --git a/core/src/main/java/google/registry/ui/server/registrar/RegistryLockGetAction.java b/core/src/main/java/google/registry/ui/server/registrar/RegistryLockGetAction.java index c819c2cec..ac047f4e6 100644 --- a/core/src/main/java/google/registry/ui/server/registrar/RegistryLockGetAction.java +++ b/core/src/main/java/google/registry/ui/server/registrar/RegistryLockGetAction.java @@ -191,14 +191,13 @@ public final class RegistryLockGetAction implements JsonGetAction { DateTime now = jpaTm().getTransactionTime(); return new ImmutableMap.Builder() .put(DOMAIN_NAME_PARAM, lock.getDomainName()) - .put( - LOCKED_TIME_PARAM, lock.getLockCompletionTimestamp().map(DateTime::toString).orElse("")) + .put(LOCKED_TIME_PARAM, lock.getLockCompletionTime().map(DateTime::toString).orElse("")) .put(LOCKED_BY_PARAM, lock.isSuperuser() ? "admin" : lock.getRegistrarPocId()) - .put(IS_LOCK_PENDING_PARAM, !lock.getLockCompletionTimestamp().isPresent()) + .put(IS_LOCK_PENDING_PARAM, !lock.getLockCompletionTime().isPresent()) .put( IS_UNLOCK_PENDING_PARAM, - lock.getUnlockRequestTimestamp().isPresent() - && !lock.getUnlockCompletionTimestamp().isPresent() + lock.getUnlockRequestTime().isPresent() + && !lock.getUnlockCompletionTime().isPresent() && !lock.isUnlockRequestExpired(now)) .put(USER_CAN_UNLOCK_PARAM, isAdmin || !lock.isSuperuser()) .build(); diff --git a/core/src/main/resources/META-INF/persistence.xml b/core/src/main/resources/META-INF/persistence.xml index 9b8087094..fec4743bb 100644 --- a/core/src/main/resources/META-INF/persistence.xml +++ b/core/src/main/resources/META-INF/persistence.xml @@ -98,7 +98,6 @@ google.registry.persistence.converter.StringSetConverter google.registry.persistence.converter.TldStateTransitionConverter google.registry.persistence.converter.TransferServerApproveEntitySetConverter - google.registry.persistence.converter.UpdateAutoTimestampConverter google.registry.persistence.converter.ZonedDateTimeConverter diff --git a/core/src/test/java/google/registry/batch/AsyncTaskEnqueuerTest.java b/core/src/test/java/google/registry/batch/AsyncTaskEnqueuerTest.java index aa4c50c5c..3c42119a4 100644 --- a/core/src/test/java/google/registry/batch/AsyncTaskEnqueuerTest.java +++ b/core/src/test/java/google/registry/batch/AsyncTaskEnqueuerTest.java @@ -148,9 +148,9 @@ public class AsyncTaskEnqueuerTest { RegistryLock lock = saveRegistryLock( new RegistryLock.Builder() - .setLockCompletionTimestamp(clock.nowUtc()) - .setUnlockRequestTimestamp(clock.nowUtc()) - .setUnlockCompletionTimestamp(clock.nowUtc()) + .setLockCompletionTime(clock.nowUtc()) + .setUnlockRequestTime(clock.nowUtc()) + .setUnlockCompletionTime(clock.nowUtc()) .isSuperuser(false) .setDomainName("example.tld") .setRepoId("repoId") diff --git a/core/src/test/java/google/registry/model/UpdateAutoTimestampTest.java b/core/src/test/java/google/registry/model/UpdateAutoTimestampTest.java index b9437d966..c6dd15592 100644 --- a/core/src/test/java/google/registry/model/UpdateAutoTimestampTest.java +++ b/core/src/test/java/google/registry/model/UpdateAutoTimestampTest.java @@ -22,13 +22,16 @@ import com.googlecode.objectify.Key; import com.googlecode.objectify.annotation.Entity; import com.googlecode.objectify.annotation.Ignore; import google.registry.model.common.CrossTldSingleton; +import google.registry.model.ofy.Ofy; import google.registry.persistence.VKey; import google.registry.schema.replay.EntityTest.EntityForTesting; import google.registry.testing.AppEngineExtension; import google.registry.testing.DualDatabaseTest; import google.registry.testing.FakeClock; +import google.registry.testing.InjectExtension; import google.registry.testing.TestOfyAndSql; import org.joda.time.DateTime; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.RegisterExtension; /** Unit tests for {@link UpdateAutoTimestamp}. */ @@ -46,6 +49,13 @@ public class UpdateAutoTimestampTest { .withClock(clock) .build(); + @RegisterExtension public final InjectExtension inject = new InjectExtension(); + + @BeforeEach + void beforeEach() { + inject.setStaticField(Ofy.class, "clock", clock); + } + /** Timestamped class. */ @Entity(name = "UatTestEntity") @javax.persistence.Entity @@ -70,6 +80,7 @@ public class UpdateAutoTimestampTest { DateTime transactionTime = tm().transact( () -> { + clock.advanceOneMilli(); UpdateAutoTimestampTestObject object = new UpdateAutoTimestampTestObject(); assertThat(object.updateTime.timestamp).isNull(); tm().insert(object); @@ -84,6 +95,7 @@ public class UpdateAutoTimestampTest { DateTime initialTime = tm().transact( () -> { + clock.advanceOneMilli(); tm().insert(new UpdateAutoTimestampTestObject()); return tm().getTransactionTime(); }); @@ -109,6 +121,7 @@ public class UpdateAutoTimestampTest { DateTime transactionTime = tm().transact( () -> { + clock.advanceOneMilli(); UpdateAutoTimestampTestObject object = new UpdateAutoTimestampTestObject(); object.updateTime = UpdateAutoTimestamp.create(DateTime.now(UTC).minusDays(1)); tm().insert(object); @@ -117,4 +130,17 @@ public class UpdateAutoTimestampTest { tm().clearSessionCache(); assertThat(reload().updateTime.timestamp).isEqualTo(transactionTime); } + + @TestOfyAndSql + void testReadingTwiceDoesNotModify() { + DateTime originalTime = DateTime.parse("1999-01-01T00:00:00Z"); + clock.setTo(originalTime); + tm().transact(() -> tm().insert(new UpdateAutoTimestampTestObject())); + clock.advanceOneMilli(); + UpdateAutoTimestampTestObject firstRead = reload(); + assertThat(firstRead.updateTime.getTimestamp()).isEqualTo(originalTime); + clock.advanceOneMilli(); + UpdateAutoTimestampTestObject secondRead = reload(); + assertThat(secondRead.updateTime.getTimestamp()).isEqualTo(originalTime); + } } diff --git a/core/src/test/java/google/registry/model/history/LegacyHistoryObjectTest.java b/core/src/test/java/google/registry/model/history/LegacyHistoryObjectTest.java index 8e0c7c2a4..599856c67 100644 --- a/core/src/test/java/google/registry/model/history/LegacyHistoryObjectTest.java +++ b/core/src/test/java/google/registry/model/history/LegacyHistoryObjectTest.java @@ -129,22 +129,26 @@ public class LegacyHistoryObjectTest extends EntityTestCase { // Next, save that from-Datastore object in SQL and verify we can load it back in jpaTm().transact(() -> jpaTm().insert(legacyDomainHistory)); - DomainHistory legacyHistoryFromSql = - jpaTm().transact(() -> jpaTm().loadByKey(legacyDomainHistory.createVKey())); - // Don't compare nsHosts directly because one is null and the other is empty - assertAboutImmutableObjects() - .that(legacyDomainHistory) - .isEqualExceptFields( - // NB: period, transaction records, and other client ID are added in #794 - legacyHistoryFromSql, - "period", - "domainTransactionRecords", - "otherClientId", - "nsHosts", - "dsDataHistories", - "gracePeriodHistories"); - assertThat(nullToEmpty(legacyDomainHistory.getNsHosts())) - .isEqualTo(nullToEmpty(legacyHistoryFromSql.getNsHosts())); + jpaTm() + .transact( + () -> { + DomainHistory legacyHistoryFromSql = + jpaTm().loadByKey(legacyDomainHistory.createVKey()); + // Don't compare nsHosts directly because one is null and the other is empty + assertAboutImmutableObjects() + .that(legacyDomainHistory) + .isEqualExceptFields( + // NB: period, transaction records, and other client ID are added in #794 + legacyHistoryFromSql, + "period", + "domainTransactionRecords", + "otherClientId", + "nsHosts", + "dsDataHistories", + "gracePeriodHistories"); + assertThat(nullToEmpty(legacyDomainHistory.getNsHosts())) + .isEqualTo(nullToEmpty(legacyHistoryFromSql.getNsHosts())); + }); } @TestSqlOnly diff --git a/core/src/test/java/google/registry/model/registry/RegistryLockDaoTest.java b/core/src/test/java/google/registry/model/registry/RegistryLockDaoTest.java index 01d55473f..09a5725f5 100644 --- a/core/src/test/java/google/registry/model/registry/RegistryLockDaoTest.java +++ b/core/src/test/java/google/registry/model/registry/RegistryLockDaoTest.java @@ -46,7 +46,7 @@ public final class RegistryLockDaoTest extends EntityTestCase { RegistryLock fromDatabase = getRegistryLockByVerificationCode(lock.getVerificationCode()).get(); assertThat(fromDatabase.getDomainName()).isEqualTo(lock.getDomainName()); assertThat(fromDatabase.getVerificationCode()).isEqualTo(lock.getVerificationCode()); - assertThat(fromDatabase.getLastUpdateTimestamp()).isEqualTo(fakeClock.nowUtc()); + assertThat(fromDatabase.getLastUpdateTime()).isEqualTo(fakeClock.nowUtc()); } @Test @@ -60,16 +60,15 @@ public final class RegistryLockDaoTest extends EntityTestCase { RegistryLock updatedLock = RegistryLockDao.getByVerificationCode(lock.getVerificationCode()).get(); RegistryLockDao.save( - updatedLock.asBuilder().setLockCompletionTimestamp(fakeClock.nowUtc()).build()); + updatedLock.asBuilder().setLockCompletionTime(fakeClock.nowUtc()).build()); }); jpaTm() .transact( () -> { RegistryLock fromDatabase = RegistryLockDao.getByVerificationCode(lock.getVerificationCode()).get(); - assertThat(fromDatabase.getLockCompletionTimestamp().get()) - .isEqualTo(fakeClock.nowUtc()); - assertThat(fromDatabase.getLastUpdateTimestamp()).isEqualTo(fakeClock.nowUtc()); + assertThat(fromDatabase.getLockCompletionTime().get()).isEqualTo(fakeClock.nowUtc()); + assertThat(fromDatabase.getLastUpdateTime()).isEqualTo(fakeClock.nowUtc()); }); } @@ -79,15 +78,14 @@ public final class RegistryLockDaoTest extends EntityTestCase { saveRegistryLock( createLock() .asBuilder() - .setLockCompletionTimestamp(fakeClock.nowUtc()) - .setUnlockRequestTimestamp(fakeClock.nowUtc()) - .setUnlockCompletionTimestamp(fakeClock.nowUtc()) + .setLockCompletionTime(fakeClock.nowUtc()) + .setUnlockRequestTime(fakeClock.nowUtc()) + .setUnlockCompletionTime(fakeClock.nowUtc()) .setRelockDuration(Duration.standardHours(6)) .build()); RegistryLock fromDatabase = getRegistryLockByVerificationCode(lock.getVerificationCode()).get(); - assertThat(fromDatabase.getUnlockRequestTimestamp()).isEqualTo(Optional.of(fakeClock.nowUtc())); - assertThat(fromDatabase.getUnlockCompletionTimestamp()) - .isEqualTo(Optional.of(fakeClock.nowUtc())); + assertThat(fromDatabase.getUnlockRequestTime()).isEqualTo(Optional.of(fakeClock.nowUtc())); + assertThat(fromDatabase.getUnlockCompletionTime()).isEqualTo(Optional.of(fakeClock.nowUtc())); assertThat(fromDatabase.isLocked()).isFalse(); assertThat(fromDatabase.getRelockDuration().get()).isEqualTo(Duration.standardHours(6)); } @@ -96,15 +94,14 @@ public final class RegistryLockDaoTest extends EntityTestCase { void testUpdateLock_usingSamePrimaryKey() { RegistryLock lock = saveRegistryLock(createLock()); fakeClock.advanceOneMilli(); - RegistryLock updatedLock = - lock.asBuilder().setLockCompletionTimestamp(fakeClock.nowUtc()).build(); + RegistryLock updatedLock = lock.asBuilder().setLockCompletionTime(fakeClock.nowUtc()).build(); saveRegistryLock(updatedLock); jpaTm() .transact( () -> { RegistryLock fromDatabase = RegistryLockDao.getByVerificationCode(lock.getVerificationCode()).get(); - assertThat(fromDatabase.getLockCompletionTimestamp()) + assertThat(fromDatabase.getLockCompletionTime()) .isEqualTo(Optional.of(fakeClock.nowUtc())); }); } @@ -140,15 +137,15 @@ public final class RegistryLockDaoTest extends EntityTestCase { createLock() .asBuilder() .setDomainName("otherexample.test") - .setLockCompletionTimestamp(fakeClock.nowUtc()) + .setLockCompletionTime(fakeClock.nowUtc()) .build(); RegistryLock unlockedLock = createLock() .asBuilder() .setDomainName("unlocked.test") - .setLockCompletionTimestamp(fakeClock.nowUtc()) - .setUnlockRequestTimestamp(fakeClock.nowUtc()) - .setUnlockCompletionTimestamp(fakeClock.nowUtc()) + .setLockCompletionTime(fakeClock.nowUtc()) + .setUnlockRequestTime(fakeClock.nowUtc()) + .setUnlockCompletionTime(fakeClock.nowUtc()) .build(); saveRegistryLock(lock); saveRegistryLock(secondLock); @@ -165,7 +162,7 @@ public final class RegistryLockDaoTest extends EntityTestCase { @Test void testLoad_byRepoId() { RegistryLock completedLock = - createLock().asBuilder().setLockCompletionTimestamp(fakeClock.nowUtc()).build(); + createLock().asBuilder().setLockCompletionTime(fakeClock.nowUtc()).build(); saveRegistryLock(completedLock); fakeClock.advanceOneMilli(); @@ -185,7 +182,7 @@ public final class RegistryLockDaoTest extends EntityTestCase { @Test void testLoad_verified_byRepoId() { RegistryLock completedLock = - createLock().asBuilder().setLockCompletionTimestamp(fakeClock.nowUtc()).build(); + createLock().asBuilder().setLockCompletionTime(fakeClock.nowUtc()).build(); saveRegistryLock(completedLock); fakeClock.advanceOneMilli(); @@ -210,9 +207,9 @@ public final class RegistryLockDaoTest extends EntityTestCase { saveRegistryLock( createLock() .asBuilder() - .setLockCompletionTimestamp(fakeClock.nowUtc()) - .setUnlockRequestTimestamp(fakeClock.nowUtc()) - .setUnlockCompletionTimestamp(fakeClock.nowUtc()) + .setLockCompletionTime(fakeClock.nowUtc()) + .setUnlockRequestTime(fakeClock.nowUtc()) + .setUnlockCompletionTime(fakeClock.nowUtc()) .build()); Optional mostRecent = getMostRecentUnlockedRegistryLockByRepoId(lock.getRepoId()); @@ -222,7 +219,7 @@ public final class RegistryLockDaoTest extends EntityTestCase { @Test void testLoad_verifiedUnlock_empty() { RegistryLock completedLock = - createLock().asBuilder().setLockCompletionTimestamp(fakeClock.nowUtc()).build(); + createLock().asBuilder().setLockCompletionTime(fakeClock.nowUtc()).build(); saveRegistryLock(completedLock); assertThat(getMostRecentUnlockedRegistryLockByRepoId(completedLock.getRepoId()).isPresent()) .isFalse(); diff --git a/core/src/test/java/google/registry/persistence/EntityCallbacksListenerTest.java b/core/src/test/java/google/registry/persistence/EntityCallbacksListenerTest.java index 915abcf24..ab4d2084a 100644 --- a/core/src/test/java/google/registry/persistence/EntityCallbacksListenerTest.java +++ b/core/src/test/java/google/registry/persistence/EntityCallbacksListenerTest.java @@ -142,6 +142,7 @@ class EntityCallbacksListenerTest { assertThat(testEntity.entityEmbedded.entityEmbeddedParentPostLoad).isEqualTo(expectedLoad); assertThat(testEntity.parentPostLoad).isEqualTo(expectedLoad); + assertThat(testEntity.parentPrePersist).isEqualTo(expectedPersist); assertThat(testEntity.parentEmbedded.parentEmbeddedPostLoad).isEqualTo(expectedLoad); assertThat(testEntity.parentEmbedded.parentEmbeddedNested.parentEmbeddedNestedPostLoad) .isEqualTo(expectedLoad); @@ -241,6 +242,7 @@ class EntityCallbacksListenerTest { private static class ParentEntity { @Embedded ParentEmbedded parentEmbedded = new ParentEmbedded(); @Transient int parentPostLoad = 0; + @Transient int parentPrePersist = 0; String parentEntity = "placeholder"; @@ -248,6 +250,11 @@ class EntityCallbacksListenerTest { void parentPostLoad() { parentPostLoad++; } + + @PrePersist + void parentPrePersist() { + parentPrePersist++; + } } @Embeddable diff --git a/core/src/test/java/google/registry/persistence/converter/UpdateAutoTimestampConverterTest.java b/core/src/test/java/google/registry/persistence/converter/UpdateAutoTimestampConverterTest.java deleted file mode 100644 index 921567ba7..000000000 --- a/core/src/test/java/google/registry/persistence/converter/UpdateAutoTimestampConverterTest.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2019 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.persistence.converter; - -import static com.google.common.truth.Truth.assertThat; -import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm; - -import google.registry.model.ImmutableObject; -import google.registry.model.UpdateAutoTimestamp; -import google.registry.persistence.transaction.JpaTestRules; -import google.registry.persistence.transaction.JpaTestRules.JpaUnitTestExtension; -import google.registry.schema.replay.EntityTest.EntityForTesting; -import google.registry.testing.FakeClock; -import javax.persistence.Entity; -import javax.persistence.Id; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; - -/** Unit tests for {@link UpdateAutoTimestampConverter}. */ -public class UpdateAutoTimestampConverterTest { - - private final FakeClock fakeClock = new FakeClock(); - - @RegisterExtension - public final JpaUnitTestExtension jpaExtension = - new JpaTestRules.Builder() - .withClock(fakeClock) - .withEntityClass(TestEntity.class) - .buildUnitTestRule(); - - @Test - void testTypeConversion() { - TestEntity ent = new TestEntity("myinst", null); - - jpaTm().transact(() -> jpaTm().insert(ent)); - - TestEntity result = - jpaTm().transact(() -> jpaTm().getEntityManager().find(TestEntity.class, "myinst")); - - assertThat(result.name).isEqualTo("myinst"); - assertThat(result.uat.getTimestamp()).isEqualTo(fakeClock.nowUtc()); - } - - @Test - void testTimeChangesOnSubsequentTransactions() { - TestEntity ent1 = new TestEntity("myinst1", null); - - jpaTm().transact(() -> jpaTm().insert(ent1)); - - TestEntity result1 = - jpaTm().transact(() -> jpaTm().getEntityManager().find(TestEntity.class, "myinst1")); - - fakeClock.advanceOneMilli(); - - TestEntity ent2 = new TestEntity("myinst2", result1.uat); - - jpaTm().transact(() -> jpaTm().insert(ent2)); - - TestEntity result2 = - jpaTm().transact(() -> jpaTm().getEntityManager().find(TestEntity.class, "myinst2")); - - assertThat(result1.uat.getTimestamp()).isNotEqualTo(result2.uat.getTimestamp()); - assertThat(result2.uat.getTimestamp()).isEqualTo(fakeClock.nowUtc()); - } - - @Entity(name = "TestEntity") // Override entity name to avoid the nested class reference. - @EntityForTesting - public static class TestEntity extends ImmutableObject { - - @Id String name; - - UpdateAutoTimestamp uat; - - public TestEntity() {} - - TestEntity(String name, UpdateAutoTimestamp uat) { - this.name = name; - this.uat = uat; - } - } -} diff --git a/core/src/test/java/google/registry/testing/ReplayExtension.java b/core/src/test/java/google/registry/testing/ReplayExtension.java index 754d399de..4526c888c 100644 --- a/core/src/test/java/google/registry/testing/ReplayExtension.java +++ b/core/src/test/java/google/registry/testing/ReplayExtension.java @@ -110,17 +110,22 @@ public class ReplayExtension implements BeforeEachCallback, AfterEachCallback { // have to compare the current value in SQL (which we just mutated) against the value that // we originally would have persisted (that being the object in the entry). VKey vkey = VKey.from(entry.getKey()); - Optional jpaValue = jpaTm().transact(() -> jpaTm().loadByKeyIfPresent(vkey)); - if (entry.getValue().equals(TransactionInfo.Delete.SENTINEL)) { - assertThat(jpaValue.isPresent()).isFalse(); - } else { - ImmutableObject immutJpaObject = (ImmutableObject) jpaValue.get(); - assertAboutImmutableObjects().that(immutJpaObject).hasCorrectHashValue(); - assertAboutImmutableObjects() - .that(immutJpaObject) - .isEqualAcrossDatabases( - (ImmutableObject) ((DatastoreEntity) entry.getValue()).toSqlEntity().get()); - } + jpaTm() + .transact( + () -> { + Optional jpaValue = jpaTm().loadByKeyIfPresent(vkey); + if (entry.getValue().equals(TransactionInfo.Delete.SENTINEL)) { + assertThat(jpaValue.isPresent()).isFalse(); + } else { + ImmutableObject immutJpaObject = (ImmutableObject) jpaValue.get(); + assertAboutImmutableObjects().that(immutJpaObject).hasCorrectHashValue(); + assertAboutImmutableObjects() + .that(immutJpaObject) + .isEqualAcrossDatabases( + (ImmutableObject) + ((DatastoreEntity) entry.getValue()).toSqlEntity().get()); + } + }); } } } diff --git a/core/src/test/java/google/registry/tools/DomainLockUtilsTest.java b/core/src/test/java/google/registry/tools/DomainLockUtilsTest.java index 7609e414c..7529aeb7e 100644 --- a/core/src/test/java/google/registry/tools/DomainLockUtilsTest.java +++ b/core/src/test/java/google/registry/tools/DomainLockUtilsTest.java @@ -104,7 +104,7 @@ public final class DomainLockUtilsTest { RegistryLock lock = domainLockUtils.saveNewRegistryLockRequest(DOMAIN_NAME, "TheRegistrar", POC_ID, false); assertNoDomainChanges(); - assertThat(lock.getLockCompletionTimestamp().isPresent()).isFalse(); + assertThat(lock.getLockCompletionTime().isPresent()).isFalse(); } @Test @@ -113,7 +113,7 @@ public final class DomainLockUtilsTest { RegistryLock lock = domainLockUtils.saveNewRegistryUnlockRequest( DOMAIN_NAME, "TheRegistrar", false, Optional.empty()); - assertThat(lock.getUnlockCompletionTimestamp().isPresent()).isFalse(); + assertThat(lock.getUnlockCompletionTime().isPresent()).isFalse(); } @Test @@ -122,7 +122,7 @@ public final class DomainLockUtilsTest { RegistryLock lock = domainLockUtils.saveNewRegistryUnlockRequest( DOMAIN_NAME, "TheRegistrar", true, Optional.empty()); - assertThat(lock.getUnlockCompletionTimestamp().isPresent()).isFalse(); + assertThat(lock.getUnlockCompletionTime().isPresent()).isFalse(); } @Test @@ -285,7 +285,7 @@ public final class DomainLockUtilsTest { RegistryLock resultLock = domainLockUtils.administrativelyApplyLock(DOMAIN_NAME, "TheRegistrar", POC_ID, true); verifyProperlyLockedDomain(true); - assertThat(resultLock.getLockCompletionTimestamp()).isEqualTo(Optional.of(clock.nowUtc())); + assertThat(resultLock.getLockCompletionTime()).isEqualTo(Optional.of(clock.nowUtc())); } @Test @@ -294,7 +294,7 @@ public final class DomainLockUtilsTest { // what the RegistryLock table says SqlHelper.saveRegistryLock( new RegistryLock.Builder() - .setLockCompletionTimestamp(clock.nowUtc()) + .setLockCompletionTime(clock.nowUtc()) .setDomainName(DOMAIN_NAME) .setVerificationCode("hi") .setRegistrarId("TheRegistrar") @@ -306,7 +306,7 @@ public final class DomainLockUtilsTest { RegistryLock resultLock = domainLockUtils.administrativelyApplyLock(DOMAIN_NAME, "TheRegistrar", POC_ID, true); verifyProperlyLockedDomain(true); - assertThat(resultLock.getLockCompletionTimestamp()).isEqualTo(Optional.of(clock.nowUtc())); + assertThat(resultLock.getLockCompletionTime()).isEqualTo(Optional.of(clock.nowUtc())); } @Test diff --git a/core/src/test/java/google/registry/tools/javascrap/BackfillRegistryLocksCommandTest.java b/core/src/test/java/google/registry/tools/javascrap/BackfillRegistryLocksCommandTest.java index 0a23a036f..a22db4747 100644 --- a/core/src/test/java/google/registry/tools/javascrap/BackfillRegistryLocksCommandTest.java +++ b/core/src/test/java/google/registry/tools/javascrap/BackfillRegistryLocksCommandTest.java @@ -68,7 +68,7 @@ class BackfillRegistryLocksCommandTest extends CommandTestCase lockOptional = getMostRecentRegistryLockByRepoId(domain.getRepoId()); Truth8.assertThat(lockOptional).isPresent(); - Truth8.assertThat(lockOptional.get().getLockCompletionTimestamp()).isPresent(); + Truth8.assertThat(lockOptional.get().getLockCompletionTime()).isPresent(); } @TestOfyAndSql @@ -111,18 +111,15 @@ class BackfillRegistryLocksCommandTest extends CommandTestCase response = action.handleJsonRequest(unlockRequest()); assertSuccess(response, "unlock", "Marla.Singer.RegistryLock@crr.com"); @@ -131,7 +131,7 @@ final class RegistryLockPostActionTest { @Test void testSuccess_unlock_relockDurationSet() throws Exception { - saveRegistryLock(createLock().asBuilder().setLockCompletionTimestamp(clock.nowUtc()).build()); + saveRegistryLock(createLock().asBuilder().setLockCompletionTime(clock.nowUtc()).build()); persistResource(domain.asBuilder().setStatusValues(REGISTRY_LOCK_STATUSES).build()); ImmutableMap request = new ImmutableMap.Builder() @@ -148,11 +148,7 @@ final class RegistryLockPostActionTest { @Test void testSuccess_unlock_adminUnlockingAdmin() throws Exception { saveRegistryLock( - createLock() - .asBuilder() - .isSuperuser(true) - .setLockCompletionTimestamp(clock.nowUtc()) - .build()); + createLock().asBuilder().isSuperuser(true).setLockCompletionTime(clock.nowUtc()).build()); persistResource(domain.asBuilder().setStatusValues(REGISTRY_LOCK_STATUSES).build()); action = createAction( @@ -187,8 +183,8 @@ final class RegistryLockPostActionTest { saveRegistryLock( createLock() .asBuilder() - .setLockCompletionTimestamp(clock.nowUtc()) - .setUnlockRequestTimestamp(clock.nowUtc()) + .setLockCompletionTime(clock.nowUtc()) + .setUnlockRequestTime(clock.nowUtc()) .build()); Map response = action.handleJsonRequest(unlockRequest()); assertFailureWithMessage(response, "A pending unlock action already exists for example.tld"); @@ -197,11 +193,7 @@ final class RegistryLockPostActionTest { @Test void testFailure_unlock_nonAdminUnlockingAdmin() { saveRegistryLock( - createLock() - .asBuilder() - .isSuperuser(true) - .setLockCompletionTimestamp(clock.nowUtc()) - .build()); + createLock().asBuilder().isSuperuser(true).setLockCompletionTime(clock.nowUtc()).build()); persistResource(domain.asBuilder().setStatusValues(REGISTRY_LOCK_STATUSES).build()); Map response = action.handleJsonRequest(unlockRequest()); assertFailureWithMessage( @@ -366,9 +358,9 @@ final class RegistryLockPostActionTest { saveRegistryLock( createLock() .asBuilder() - .setLockCompletionTimestamp(clock.nowUtc().minusMinutes(1)) - .setUnlockRequestTimestamp(clock.nowUtc().minusMinutes(1)) - .setUnlockCompletionTimestamp(clock.nowUtc().minusMinutes(1)) + .setLockCompletionTime(clock.nowUtc().minusMinutes(1)) + .setUnlockRequestTime(clock.nowUtc().minusMinutes(1)) + .setUnlockCompletionTime(clock.nowUtc().minusMinutes(1)) .build()); Map response = action.handleJsonRequest(lockRequest()); @@ -380,7 +372,7 @@ final class RegistryLockPostActionTest { RegistryLock previousLock = saveRegistryLock(createLock()); String verificationCode = previousLock.getVerificationCode(); previousLock = getRegistryLockByVerificationCode(verificationCode).get(); - clock.setTo(previousLock.getLockRequestTimestamp().plusHours(2)); + clock.setTo(previousLock.getLockRequestTime().plusHours(2)); Map response = action.handleJsonRequest(lockRequest()); assertSuccess(response, "lock", "Marla.Singer.RegistryLock@crr.com"); } diff --git a/core/src/test/java/google/registry/ui/server/registrar/RegistryLockVerifyActionTest.java b/core/src/test/java/google/registry/ui/server/registrar/RegistryLockVerifyActionTest.java index 5653f913b..6de3ee300 100644 --- a/core/src/test/java/google/registry/ui/server/registrar/RegistryLockVerifyActionTest.java +++ b/core/src/test/java/google/registry/ui/server/registrar/RegistryLockVerifyActionTest.java @@ -114,8 +114,7 @@ final class RegistryLockVerifyActionTest { void testSuccess_unlockDomain() { action = createAction(lockId, false); domain = persistResource(domain.asBuilder().setStatusValues(REGISTRY_LOCK_STATUSES).build()); - saveRegistryLock( - createLock().asBuilder().setUnlockRequestTimestamp(fakeClock.nowUtc()).build()); + saveRegistryLock(createLock().asBuilder().setUnlockRequestTime(fakeClock.nowUtc()).build()); action.run(); assertThat(response.getStatus()).isEqualTo(SC_OK); assertThat(response.getPayload()).contains("Success: unlock has been applied to example.tld"); @@ -151,8 +150,7 @@ final class RegistryLockVerifyActionTest { @Test void testFailure_alreadyVerified() { - saveRegistryLock( - createLock().asBuilder().setLockCompletionTimestamp(fakeClock.nowUtc()).build()); + saveRegistryLock(createLock().asBuilder().setLockCompletionTime(fakeClock.nowUtc()).build()); action.run(); assertThat(response.getPayload()).contains("Failed: Domain example.tld is already locked"); assertNoDomainChanges(); @@ -182,9 +180,9 @@ final class RegistryLockVerifyActionTest { saveRegistryLock( createLock() .asBuilder() - .setLockCompletionTimestamp(fakeClock.nowUtc()) - .setUnlockRequestTimestamp(fakeClock.nowUtc()) - .setUnlockCompletionTimestamp(fakeClock.nowUtc()) + .setLockCompletionTime(fakeClock.nowUtc()) + .setUnlockRequestTime(fakeClock.nowUtc()) + .setUnlockCompletionTime(fakeClock.nowUtc()) .build()); action.run(); assertThat(response.getPayload()).contains("Failed: Domain example.tld is already unlocked"); @@ -234,8 +232,8 @@ final class RegistryLockVerifyActionTest { saveRegistryLock( createLock() .asBuilder() - .setLockCompletionTimestamp(fakeClock.nowUtc()) - .setUnlockRequestTimestamp(fakeClock.nowUtc()) + .setLockCompletionTime(fakeClock.nowUtc()) + .setUnlockRequestTime(fakeClock.nowUtc()) .build()); action.run(); assertThat(response.getPayload()).contains("Failed: Domain example.tld is already locked"); @@ -258,7 +256,7 @@ final class RegistryLockVerifyActionTest { saveRegistryLock( lock.asBuilder() .setVerificationCode(unlockVerificationCode) - .setUnlockRequestTimestamp(fakeClock.nowUtc()) + .setUnlockRequestTime(fakeClock.nowUtc()) .build()); action = createAction(unlockVerificationCode, false); action.run(); @@ -282,8 +280,7 @@ final class RegistryLockVerifyActionTest { void testFailure_unlock_unlockAgain() { action = createAction(lockId, false); domain = persistResource(domain.asBuilder().setStatusValues(REGISTRY_LOCK_STATUSES).build()); - saveRegistryLock( - createLock().asBuilder().setUnlockRequestTimestamp(fakeClock.nowUtc()).build()); + saveRegistryLock(createLock().asBuilder().setUnlockRequestTime(fakeClock.nowUtc()).build()); action.run(); assertThat(response.getStatus()).isEqualTo(SC_OK); assertThat(response.getPayload()).contains("Success: unlock has been applied to example.tld"); diff --git a/core/src/test/java/google/registry/webdriver/RegistrarConsoleScreenshotTest.java b/core/src/test/java/google/registry/webdriver/RegistrarConsoleScreenshotTest.java index a5697ac4e..91f3cce17 100644 --- a/core/src/test/java/google/registry/webdriver/RegistrarConsoleScreenshotTest.java +++ b/core/src/test/java/google/registry/webdriver/RegistrarConsoleScreenshotTest.java @@ -465,8 +465,8 @@ class RegistrarConsoleScreenshotTest extends WebDriverTestCase { saveRegistryLock( createRegistryLock(expiredUnlockRequestDomain) .asBuilder() - .setLockCompletionTimestamp(START_OF_TIME.minusDays(1)) - .setUnlockRequestTimestamp(START_OF_TIME.minusDays(1)) + .setLockCompletionTime(START_OF_TIME.minusDays(1)) + .setUnlockRequestTime(START_OF_TIME.minusDays(1)) .build()); DomainBase domain = persistActiveDomain("example.tld"); saveRegistryLock(createRegistryLock(domain).asBuilder().isSuperuser(true).build()); @@ -498,8 +498,8 @@ class RegistrarConsoleScreenshotTest extends WebDriverTestCase { .setRegistrarPocId("Marla.Singer@crr.com") .setDomainName(pendingUnlockDomain.getDomainName()) .setRepoId(pendingUnlockDomain.getRepoId()) - .setLockCompletionTimestamp(START_OF_TIME) - .setUnlockRequestTimestamp(START_OF_TIME) + .setLockCompletionTime(START_OF_TIME) + .setUnlockRequestTime(START_OF_TIME) .build()); return null; }); @@ -568,7 +568,7 @@ class RegistrarConsoleScreenshotTest extends WebDriverTestCase { .isSuperuser(false) .setRegistrarId("TheRegistrar") .setRegistrarPocId("Marla.Singer@crr.com") - .setLockCompletionTimestamp(START_OF_TIME) + .setLockCompletionTime(START_OF_TIME) .setDomainName(domainBase.getDomainName()) .setRepoId(domainBase.getRepoId()) .build(); 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 590d5b0cb..213897f78 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 - 2021-03-19 12:31:33.396532 + 2021-03-24 01:27:00.824998 last flyway file - V89__host_history_host_deferred.sql + V90__update_timestamp.sql @@ -284,7 +284,7 @@ td.section { generated on - 2021-03-19 12:31:33.396532 + 2021-03-24 01:27:00.824998 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 54c3b23a5..30e3e5d29 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,6247 +261,6247 @@ td.section { generated on - 2021-03-19 12:31:31.233378 + 2021-03-24 01:26:58.684653 last flyway file - V89__host_history_host_deferred.sql + V90__update_timestamp.sql

 

 

- + SchemaCrawler_Diagram - - + + generated by - + SchemaCrawler 16.10.1 - + generated on - - 2021-03-19 12:31:31.233378 + + 2021-03-24 01:26:58.684653 - + allocationtoken_a08ccbef - - + + public.AllocationToken - - + + [table] - + token - + - + text not null - + update_timestamp - + - + timestamptz - + allowed_registrar_ids - + - + _text - + allowed_tlds - + - + _text - + creation_time - + - + timestamptz not null - + discount_fraction - + - + float8(17, 17) not null - + discount_premiums - + - + bool not null - + discount_years - + - + int4 not null - + domain_name - + - + text - + redemption_domain_repo_id - + - + text - + token_status_transitions - + - + "hstore" - + token_type - + - + text - + redemption_domain_history_id - + - + int8 - + billingevent_a57d1815 - - + + public.BillingEvent - - + + [table] - + billing_event_id - + - + int8 not null - + registrar_id - + - + text not null - + domain_history_revision_id - + - + int8 not null - + domain_repo_id - + - + text not null - + event_time - + - + timestamptz not null - + flags - + - + _text - + reason - + - + text not null - + domain_name - + - + text not null - + allocation_token - + - + text - + billing_time - + - + timestamptz - + cancellation_matching_billing_recurrence_id - + - + int8 - + cost_amount - + - + numeric(19, 2) - + cost_currency - + - + text - + period_years - + - + int4 - + synthetic_creation_time - + - + timestamptz - + billingevent_a57d1815:w->allocationtoken_a08ccbef:e - - - - - - - - + + + + + + + + fk_billing_event_allocation_token billingrecurrence_5fa2cb01 - - + + public.BillingRecurrence - - + + [table] - + billing_recurrence_id - + - + int8 not null - + registrar_id - + - + text not null - + domain_history_revision_id - + - + int8 not null - + domain_repo_id - + - + text not null - + event_time - + - + timestamptz not null - + flags - + - + _text - + reason - + - + text not null - + domain_name - + - + text not null - + recurrence_end_time - + - + timestamptz - + recurrence_time_of_year - + - + text - + billingevent_a57d1815:w->billingrecurrence_5fa2cb01:e - - - - - - - - + + + + + + + + fk_billing_event_cancellation_matching_billing_recurrence_id domainhistory_a54cc226 - - + + public.DomainHistory - - + + [table] - + history_revision_id - + - + int8 not null - + history_by_superuser - + - + bool not null - + history_registrar_id - + - + text - + history_modification_time - + - + timestamptz not null - + history_reason - + - + text - + history_requested_by_registrar - + - + bool - + history_client_transaction_id - + - + text - + history_server_transaction_id - + - + text - + history_type - + - + text not null - + history_xml_bytes - + - + bytea - + admin_contact - + - + text - + auth_info_repo_id - + - + text - + auth_info_value - + - + text - + billing_recurrence_id - + - + int8 - + autorenew_poll_message_id - + - + int8 - + billing_contact - + - + text - + deletion_poll_message_id - + - + int8 - + domain_name - + - + text - + idn_table_name - + - + text - + last_transfer_time - + - + timestamptz - + launch_notice_accepted_time - + - + timestamptz - + launch_notice_expiration_time - + - + timestamptz - + launch_notice_tcn_id - + - + text - + launch_notice_validator_id - + - + text - + registrant_contact - + - + text - + registration_expiration_time - + - + timestamptz - + smd_id - + - + text - + subordinate_hosts - + - + _text - + tech_contact - + - + text - + tld - + - + text - + transfer_billing_cancellation_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_poll_message_id_1 - + - + int8 - + transfer_poll_message_id_2 - + - + int8 - + transfer_client_txn_id - + - + text - + transfer_server_txn_id - + - + text - + transfer_gaining_registrar_id - + - + text - + transfer_losing_registrar_id - + - + text - + transfer_pending_expiration_time - + - + timestamptz - + transfer_request_time - + - + timestamptz - + transfer_status - + - + text - + creation_registrar_id - + - + text - + creation_time - + - + timestamptz - + current_sponsor_registrar_id - + - + text - + deletion_time - + - + timestamptz - + last_epp_update_registrar_id - + - + text - + last_epp_update_time - + - + timestamptz - + statuses - + - + _text - + update_timestamp - + - + timestamptz - + domain_repo_id - + - + text not null - + autorenew_end_time - + - + timestamptz - + history_other_registrar_id - + - + text - + history_period_unit - + - + text - + history_period_value - + - + int4 - + billing_recurrence_history_id - + - + int8 - + autorenew_poll_message_history_id - + - + int8 - + deletion_poll_message_history_id - + - + int8 - + transfer_billing_recurrence_history_id - + - + int8 - + transfer_autorenew_poll_message_history_id - + - + int8 - + transfer_billing_event_history_id - + - + int8 - + transfer_history_entry_id - + - + int8 - + transfer_repo_id - + - + text - + transfer_poll_message_id_3 - + - + int8 - + transfer_billing_cancellation_history_id - + - + int8 - + billingevent_a57d1815:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fk_billing_event_domain_history billingevent_a57d1815:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fk_billing_event_domain_history registrar_6e1503e3 - - + + public.Registrar - - + + [table] - + registrar_id - + - + text not null - + allowed_tlds - + - + _text - + billing_account_map - + - + "hstore" - + billing_identifier - + - + int8 - + block_premium_names - + - + bool not null - + client_certificate - + - + text - + client_certificate_hash - + - + text - + contacts_require_syncing - + - + bool not null - + creation_time - + - + timestamptz - + drive_folder_id - + - + text - + email_address - + - + text - + failover_client_certificate - + - + text - + failover_client_certificate_hash - + - + text - + fax_number - + - + text - + iana_identifier - + - + int8 - + icann_referral_email - + - + text - + i18n_address_city - + - + text - + i18n_address_country_code - + - + text - + i18n_address_state - + - + text - + i18n_address_street_line1 - + - + text - + i18n_address_street_line2 - + - + text - + i18n_address_street_line3 - + - + text - + i18n_address_zip - + - + text - + ip_address_allow_list - + - + _text - + last_certificate_update_time - + - + timestamptz - + last_update_time - + - - timestamptz + + timestamptz not null - + localized_address_city - + - + text - + localized_address_country_code - + - + text - + localized_address_state - + - + text - + localized_address_street_line1 - + - + text - + localized_address_street_line2 - + - + text - + localized_address_street_line3 - + - + text - + localized_address_zip - + - + text - + password_hash - + - + text - + phone_number - + - + text - + phone_passcode - + - + text - + po_number - + - + text - + rdap_base_urls - + - + _text - + registrar_name - + - + text not null - + registry_lock_allowed - + - + bool not null - + password_salt - + - + text - + state - + - + text - + type - + - + text not null - + url - + - + text - + whois_server - + - + text - + billingevent_a57d1815:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_billing_event_registrar_id billingcancellation_6eedf614 - - + + public.BillingCancellation - - + + [table] - + billing_cancellation_id - + - + int8 not null - + registrar_id - + - + text not null - + domain_history_revision_id - + - + int8 not null - + domain_repo_id - + - + text not null - + event_time - + - + timestamptz not null - + flags - + - + _text - + reason - + - + text not null - + domain_name - + - + text not null - + billing_time - + - + timestamptz - + billing_event_id - + - + int8 - + billing_recurrence_id - + - + int8 - + billing_event_history_id - + - + int8 - + billing_event_domain_repo_id - + - + text - + billing_recurrence_history_id - + - + int8 - + billing_recurrence_domain_repo_id - + - + text - + billingcancellation_6eedf614:w->billingevent_a57d1815:e - - - - - - - - + + + + + + + + fk_billing_cancellation_billing_event_id billingcancellation_6eedf614:w->billingrecurrence_5fa2cb01:e - - - - - - - - + + + + + + + + fk_billing_cancellation_billing_recurrence_id billingcancellation_6eedf614:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fk_billing_cancellation_domain_history billingcancellation_6eedf614:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fk_billing_cancellation_domain_history billingcancellation_6eedf614:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_billing_cancellation_registrar_id domain_6c51cffa - - + + public.Domain - - + + [table] - + repo_id - + - + text not null - + creation_registrar_id - + - + text not null - + creation_time - + - + timestamptz not null - + current_sponsor_registrar_id - + - + text not null - + deletion_time - + - + timestamptz - + last_epp_update_registrar_id - + - + text - + last_epp_update_time - + - + timestamptz - + statuses - + - + _text - + auth_info_repo_id - + - + text - + auth_info_value - + - + text - + domain_name - + - + text - + idn_table_name - + - + text - + last_transfer_time - + - + timestamptz - + launch_notice_accepted_time - + - + timestamptz - + launch_notice_expiration_time - + - + timestamptz - + launch_notice_tcn_id - + - + text - + launch_notice_validator_id - + - + text - + registration_expiration_time - + - + timestamptz - + smd_id - + - + text - + subordinate_hosts - + - + _text - + tld - + - + text - + admin_contact - + - + text - + billing_contact - + - + text - + registrant_contact - + - + text - + tech_contact - + - + text - + transfer_poll_message_id_1 - + - + int8 - + transfer_poll_message_id_2 - + - + int8 - + transfer_billing_cancellation_id - + - + int8 - + transfer_billing_event_id - + - + int8 - + transfer_billing_recurrence_id - + - + int8 - + transfer_autorenew_poll_message_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 - + transfer_request_time - + - + timestamptz - + transfer_status - + - + text - + update_timestamp - + - + timestamptz - + billing_recurrence_id - + - + int8 - + autorenew_poll_message_id - + - + int8 - + deletion_poll_message_id - + - + int8 - + autorenew_end_time - + - + timestamptz - + billing_recurrence_history_id - + - + int8 - + autorenew_poll_message_history_id - + - + int8 - + deletion_poll_message_history_id - + - + int8 - + transfer_billing_recurrence_history_id - + - + int8 - + transfer_autorenew_poll_message_history_id - + - + int8 - + transfer_billing_event_history_id - + - + int8 - + transfer_history_entry_id - + - + int8 - + transfer_repo_id - + - + text - + transfer_poll_message_id_3 - + - + int8 - + transfer_billing_cancellation_history_id - + - + int8 - + domain_6c51cffa:w->billingevent_a57d1815:e - - - - - - - - + + + + + + + + fk_domain_transfer_billing_event_id domain_6c51cffa:w->billingcancellation_6eedf614:e - - - - - - - - + + + + + + + + fk_domain_transfer_billing_cancellation_id domain_6c51cffa:w->billingrecurrence_5fa2cb01:e - - - - - - - - + + + + + + + + fk_domain_billing_recurrence_id domain_6c51cffa:w->billingrecurrence_5fa2cb01:e - - - - - - - - + + + + + + + + fk_domain_transfer_billing_recurrence_id contact_8de8cb16 - - + + public.Contact - - + + [table] - + repo_id - + - + text not null - + creation_registrar_id - + - + text not null - + creation_time - + - + timestamptz not null - + current_sponsor_registrar_id - + - + text not null - + deletion_time - + - + timestamptz - + last_epp_update_registrar_id - + - + text - + last_epp_update_time - + - + timestamptz - + statuses - + - + _text - + auth_info_repo_id - + - + text - + auth_info_value - + - + text - + contact_id - + - + text - + disclose_types_addr - + - + _text - + disclose_show_email - + - + bool - + disclose_show_fax - + - + bool - + disclose_mode_flag - + - + bool - + disclose_types_name - + - + _text - + disclose_types_org - + - + _text - + disclose_show_voice - + - + bool - + email - + - + text - + fax_phone_extension - + - + text - + fax_phone_number - + - + text - + addr_i18n_city - + - + text - + addr_i18n_country_code - + - + text - + addr_i18n_state - + - + text - + addr_i18n_street_line1 - + - + text - + addr_i18n_street_line2 - + - + text - + addr_i18n_street_line3 - + - + text - + addr_i18n_zip - + - + text - + addr_i18n_name - + - + text - + addr_i18n_org - + - + text - + addr_i18n_type - + - + text - + last_transfer_time - + - + timestamptz - + addr_local_city - + - + text - + addr_local_country_code - + - + text - + addr_local_state - + - + text - + addr_local_street_line1 - + - + text - + addr_local_street_line2 - + - + text - + addr_local_street_line3 - + - + text - + addr_local_zip - + - + text - + addr_local_name - + - + text - + addr_local_org - + - + text - + addr_local_type - + - + text - + search_name - + - + text - + voice_phone_extension - + - + text - + voice_phone_number - + - + text - + transfer_poll_message_id_1 - + - + int8 - + transfer_poll_message_id_2 - + - + int8 - + transfer_client_txn_id - + - + text - + transfer_server_txn_id - + - + text - + transfer_gaining_registrar_id - + - + text - + transfer_losing_registrar_id - + - + text - + transfer_pending_expiration_time - + - + timestamptz - + transfer_request_time - + - + timestamptz - + transfer_status - + - + text - + update_timestamp - + - + timestamptz - + transfer_history_entry_id - + - + int8 - + transfer_repo_id - + - + text - + transfer_poll_message_id_3 - + - + int8 - + domain_6c51cffa:w->contact_8de8cb16:e - - - - - - - - + + + + + + + + fk_domain_admin_contact domain_6c51cffa:w->contact_8de8cb16:e - - - - - - - - + + + + + + + + fk_domain_billing_contact domain_6c51cffa:w->contact_8de8cb16:e - - - - - - - - + + + + + + + + fk_domain_registrant_contact domain_6c51cffa:w->contact_8de8cb16:e - - - - - - - - + + + + + + + + fk_domain_tech_contact domain_6c51cffa:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk2jc69qyg2tv9hhnmif6oa1cx1 domain_6c51cffa:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk2u3srsfbei272093m3b3xwj23 domain_6c51cffa:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fkjc0r9r5y1lfbt4gpbqw4wsuvq domain_6c51cffa:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_domain_transfer_gaining_registrar_id domain_6c51cffa:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_domain_transfer_losing_registrar_id tld_f1fa57e2 - - + + public.Tld - - + + [table] - + tld_name - + - + text not null - + add_grace_period_length - + - + interval not null - + allowed_fully_qualified_host_names - + - + _text - + allowed_registrant_contact_ids - + - + _text - + anchor_tenant_add_grace_period_length - + - + interval not null - + auto_renew_grace_period_length - + - + interval not null - + automatic_transfer_length - + - + interval not null - + claims_period_end - + - + timestamptz not null - + create_billing_cost_amount - + - + numeric(19, 2) - + create_billing_cost_currency - + - + text - + creation_time - + - + timestamptz not null - + currency - + - + text not null - + dns_paused - + - + bool not null - + dns_writers - + - + _text not null - + drive_folder_id - + - + text - + eap_fee_schedule - + - + "hstore" not null - + escrow_enabled - + - + bool not null - + invoicing_enabled - + - + bool not null - + lordn_username - + - + text - + num_dns_publish_locks - + - + int4 not null - + pending_delete_length - + - + interval not null - + premium_list_name - + - + text - + pricing_engine_class_name - + - + text - + redemption_grace_period_length - + - + interval not null - + registry_lock_or_unlock_cost_amount - + - + numeric(19, 2) - + registry_lock_or_unlock_cost_currency - + - + text - + renew_billing_cost_transitions - + - + "hstore" not null - + renew_grace_period_length - + - + interval not null - + reserved_list_names - + - + _text - + restore_billing_cost_amount - + - + numeric(19, 2) - + restore_billing_cost_currency - + - + text - + roid_suffix - + - + text - + server_status_change_billing_cost_amount - + - + numeric(19, 2) - + server_status_change_billing_cost_currency - + - + text - + tld_state_transitions - + - + "hstore" not null - + tld_type - + - + text not null - + tld_unicode - + - + text not null - + transfer_grace_period_length - + - + interval not null - + domain_6c51cffa:w->tld_f1fa57e2:e - - - - - - - - + + + + + + + + fk_domain_tld graceperiod_cd3b2e8f - - + + public.GracePeriod - - + + [table] - + grace_period_id - + - + int8 not null - + billing_event_id - + - + int8 - + billing_recurrence_id - + - + int8 - + registrar_id - + - + text not null - + domain_repo_id - + - + text not null - + expiration_time - + - + timestamptz not null - + type - + - + text not null - + billing_event_history_id - + - + int8 - + billing_recurrence_history_id - + - + int8 - + billing_event_domain_repo_id - + - + text - + billing_recurrence_domain_repo_id - + - + text - + graceperiod_cd3b2e8f:w->billingevent_a57d1815:e - - - - - - - - + + + + + + + + fk_grace_period_billing_event_id graceperiod_cd3b2e8f:w->domain_6c51cffa:e - - - - - - - - + + + + + + + + fk_grace_period_domain_repo_id graceperiod_cd3b2e8f:w->billingrecurrence_5fa2cb01:e - - - - - - - - + + + + + + + + fk_grace_period_billing_recurrence_id graceperiod_cd3b2e8f:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_grace_period_registrar_id billingrecurrence_5fa2cb01:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fk_billing_recurrence_domain_history billingrecurrence_5fa2cb01:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fk_billing_recurrence_domain_history billingrecurrence_5fa2cb01:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_billing_recurrence_registrar_id claimsentry_105da9f1 - - + + public.ClaimsEntry - - + + [table] - + revision_id - + - + int8 not null - + claim_key - + - + text not null - + domain_label - + - + text not null - + claimslist_3d49bc2b - - + + public.ClaimsList - - + + [table] - + revision_id - + - + bigserial not null - + - + auto-incremented - + creation_timestamp - + - + timestamptz not null - + tmdb_generation_time - + - + timestamptz not null - + claimsentry_105da9f1:w->claimslist_3d49bc2b:e - - - - - - - - + + + + + + + + fk6sc6at5hedffc0nhdcab6ivuq contact_8de8cb16:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk1sfyj7o7954prbn1exk7lpnoe contact_8de8cb16:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk93c185fx7chn68uv7nl6uv2s0 contact_8de8cb16:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fkmb7tdiv85863134w1wogtxrb2 contact_8de8cb16:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_contact_transfer_gaining_registrar_id contact_8de8cb16:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_contact_transfer_losing_registrar_id contacthistory_d2964f8a - - + + public.ContactHistory - - + + [table] - + history_revision_id - + - + int8 not null - + history_by_superuser - + - + bool not null - + history_registrar_id - + - + text - + history_modification_time - + - + timestamptz not null - + history_reason - + - + text - + history_requested_by_registrar - + - + bool - + history_client_transaction_id - + - + text - + history_server_transaction_id - + - + text - + history_type - + - + text not null - + history_xml_bytes - + - + bytea - + auth_info_repo_id - + - + text - + auth_info_value - + - + text - + contact_id - + - + text - + disclose_types_addr - + - + _text - + disclose_show_email - + - + bool - + disclose_show_fax - + - + bool - + disclose_mode_flag - + - + bool - + disclose_types_name - + - + _text - + disclose_types_org - + - + _text - + disclose_show_voice - + - + bool - + email - + - + text - + fax_phone_extension - + - + text - + fax_phone_number - + - + text - + addr_i18n_city - + - + text - + addr_i18n_country_code - + - + text - + addr_i18n_state - + - + text - + addr_i18n_street_line1 - + - + text - + addr_i18n_street_line2 - + - + text - + addr_i18n_street_line3 - + - + text - + addr_i18n_zip - + - + text - + addr_i18n_name - + - + text - + addr_i18n_org - + - + text - + addr_i18n_type - + - + text - + last_transfer_time - + - + timestamptz - + addr_local_city - + - + text - + addr_local_country_code - + - + text - + addr_local_state - + - + text - + addr_local_street_line1 - + - + text - + addr_local_street_line2 - + - + text - + addr_local_street_line3 - + - + text - + addr_local_zip - + - + text - + addr_local_name - + - + text - + addr_local_org - + - + text - + addr_local_type - + - + text - + search_name - + - + text - + transfer_poll_message_id_1 - + - + int8 - + transfer_poll_message_id_2 - + - + int8 - + transfer_client_txn_id - + - + text - + transfer_server_txn_id - + - + text - + transfer_gaining_registrar_id - + - + text - + transfer_losing_registrar_id - + - + text - + transfer_pending_expiration_time - + - + timestamptz - + transfer_request_time - + - + timestamptz - + transfer_status - + - + text - + voice_phone_extension - + - + text - + voice_phone_number - + - + text - + creation_registrar_id - + - + text - + creation_time - + - + timestamptz - + current_sponsor_registrar_id - + - + text - + deletion_time - + - + timestamptz - + last_epp_update_registrar_id - + - + text - + last_epp_update_time - + - + timestamptz - + statuses - + - + _text - + contact_repo_id - + - + text not null - + update_timestamp - + - + timestamptz - + transfer_history_entry_id - + - + int8 - + transfer_repo_id - + - + text - + transfer_poll_message_id_3 - + - + int8 - + contacthistory_d2964f8a:w->contact_8de8cb16:e - - - - - - - - + + + + + + + + fk_contact_history_contact_repo_id contacthistory_d2964f8a:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_contact_history_registrar_id pollmessage_614a523e - - + + public.PollMessage - - + + [table] - + type - + - + text not null - + poll_message_id - + - + int8 not null - + registrar_id - + - + text not null - + contact_repo_id - + - + text - + contact_history_revision_id - + - + int8 - + domain_repo_id - + - + text - + domain_history_revision_id - + - + int8 - + event_time - + - + timestamptz not null - + host_repo_id - + - + text - + host_history_revision_id - + - + int8 - + message - + - + text - + transfer_response_contact_id - + - + text - + transfer_response_domain_expiration_time - + - + timestamptz - + transfer_response_domain_name - + - + text - + pending_action_response_action_result - + - + bool - + pending_action_response_name_or_id - + - + text - + pending_action_response_processed_date - + - + timestamptz - + pending_action_response_client_txn_id - + - + text - + pending_action_response_server_txn_id - + - + text - + transfer_response_gaining_registrar_id - + - + text - + transfer_response_losing_registrar_id - + - + text - + transfer_response_pending_transfer_expiration_time - + - + timestamptz - + transfer_response_transfer_request_time - + - + timestamptz - + transfer_response_transfer_status - + - + text - + autorenew_end_time - + - + timestamptz - + autorenew_domain_name - + - + text - + pollmessage_614a523e:w->domain_6c51cffa:e - - - - - - - - + + + + + + + + fk_poll_message_domain_repo_id pollmessage_614a523e:w->contact_8de8cb16:e - - - - - - - - + + + + + + + + fk_poll_message_contact_repo_id pollmessage_614a523e:w->contacthistory_d2964f8a:e - - - - - - - - + + + + + + + + fk_poll_message_contact_history pollmessage_614a523e:w->contacthistory_d2964f8a:e - - - - - - - - + + + + + + + + fk_poll_message_contact_history pollmessage_614a523e:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fk_poll_message_domain_history pollmessage_614a523e:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fk_poll_message_domain_history host_f21b78de - - + + public.Host - - + + [table] - + repo_id - + - + text not null - + creation_registrar_id - + - + text - + creation_time - + - + timestamptz - + current_sponsor_registrar_id - + - + text - + deletion_time - + - + timestamptz - + last_epp_update_registrar_id - + - + text - + last_epp_update_time - + - + timestamptz - + statuses - + - + _text - + host_name - + - + text - + last_superordinate_change - + - + timestamptz - + last_transfer_time - + - + timestamptz - + superordinate_domain - + - + text - + inet_addresses - + - + _text - + update_timestamp - + - + timestamptz - + transfer_poll_message_id_3 - + - + int8 - + pollmessage_614a523e:w->host_f21b78de:e - - - - - - - - + + + + + + + + fk_poll_message_host_repo_id hosthistory_56210c2 - - + + public.HostHistory - - + + [table] - + history_revision_id - + - + int8 not null - + history_by_superuser - + - + bool not null - + history_registrar_id - + - + text not null - + history_modification_time - + - + timestamptz not null - + history_reason - + - + text - + history_requested_by_registrar - + - + bool - + history_client_transaction_id - + - + text - + history_server_transaction_id - + - + text - + history_type - + - + text not null - + history_xml_bytes - + - + bytea - + host_name - + - + text - + inet_addresses - + - + _text - + last_superordinate_change - + - + timestamptz - + last_transfer_time - + - + timestamptz - + superordinate_domain - + - + text - + creation_registrar_id - + - + text - + creation_time - + - + timestamptz - + current_sponsor_registrar_id - + - + text - + deletion_time - + - + timestamptz - + last_epp_update_registrar_id - + - + text - + last_epp_update_time - + - + timestamptz - + statuses - + - + _text - + host_repo_id - + - + text not null - + update_timestamp - + - + timestamptz - + transfer_poll_message_id_3 - + - + int8 - + pollmessage_614a523e:w->hosthistory_56210c2:e - - - - - - - - + + + + + + + + fk_poll_message_host_history pollmessage_614a523e:w->hosthistory_56210c2:e - - - - - - - - + + + + + + + + fk_poll_message_host_history pollmessage_614a523e:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_poll_message_registrar_id pollmessage_614a523e:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_poll_message_transfer_response_gaining_registrar_id pollmessage_614a523e:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_poll_message_transfer_response_losing_registrar_id cursor_6af40e8c - - + + public."Cursor" - - + + [table] - + "scope" - + - + text not null - + type - + - + text not null - + cursor_time - + - + timestamptz not null - + last_update_time - + - + timestamptz not null - + delegationsignerdata_e542a872 - - + + public.DelegationSignerData - - + + [table] - + domain_repo_id - + - + text not null - + key_tag - + - + int4 not null - + algorithm - + - + int4 not null - + digest - + - + bytea not null - + digest_type - + - + int4 not null - + delegationsignerdata_e542a872:w->domain_6c51cffa:e - - - - - - - - + + + + + + + + fktr24j9v14ph2mfuw2gsmt12kq domainhistory_a54cc226:w->domain_6c51cffa:e - - - - - - - - + + + + + + + + fk_domain_history_domain_repo_id domainhistory_a54cc226:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_domain_history_registrar_id domainhost_1ea127c2 - - + + public.DomainHost - - + + [table] - + domain_repo_id - + - + text not null - + host_repo_id - + - + text - + domainhost_1ea127c2:w->domain_6c51cffa:e - - - - - - - - + + + + + + + + fkfmi7bdink53swivs390m2btxg domainhost_1ea127c2:w->host_f21b78de:e - - - - - - - - + + + + + + + + fk_domainhost_host_valid host_f21b78de:w->domain_6c51cffa:e - - - - - - - - + + + + + + + + fk_host_superordinate_domain host_f21b78de:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_host_creation_registrar_id host_f21b78de:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_host_current_sponsor_registrar_id host_f21b78de:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_host_last_epp_update_registrar_id domaindsdatahistory_995b060d - - + + public.DomainDsDataHistory - - + + [table] - + ds_data_history_revision_id - + - + int8 not null - + algorithm - + - + int4 not null - + digest - + - + bytea not null - + digest_type - + - + int4 not null - + domain_history_revision_id - + - + int8 not null - + key_tag - + - + int4 not null - + domain_repo_id - + - + text - + domaindsdatahistory_995b060d:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fko4ilgyyfnvppbpuivus565i0j domaindsdatahistory_995b060d:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fko4ilgyyfnvppbpuivus565i0j domainhistoryhost_9f3f23ee - - + + public.DomainHistoryHost - - + + [table] - + domain_history_history_revision_id - + - + int8 not null - + host_repo_id - + - + text - + domain_history_domain_repo_id - + - + text not null - + domainhistoryhost_9f3f23ee:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fka9woh3hu8gx5x0vly6bai327n domainhistoryhost_9f3f23ee:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fka9woh3hu8gx5x0vly6bai327n domaintransactionrecord_6e77ff61 - - + + public.DomainTransactionRecord - - + + [table] - + id - + - + bigserial not null - + - + auto-incremented - + report_amount - + - + int4 not null - + report_field - + - + text not null - + reporting_time - + - + timestamptz not null - + tld - + - + text not null - + domain_repo_id - + - + text - + history_revision_id - + - + int8 - + domaintransactionrecord_6e77ff61:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fkcjqe54u72kha71vkibvxhjye7 domaintransactionrecord_6e77ff61:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fkcjqe54u72kha71vkibvxhjye7 domaintransactionrecord_6e77ff61:w->tld_f1fa57e2:e - - - - - - - - + + + + + + + + fk_domain_transaction_record_tld graceperiodhistory_40ccc1f1 - - + + public.GracePeriodHistory - - + + [table] - + grace_period_history_revision_id - + - + int8 not null - + billing_event_id - + - + int8 - + billing_event_history_id - + - + int8 - + billing_recurrence_id - + - + int8 - + billing_recurrence_history_id - + - + int8 - + registrar_id - + - + text not null - + domain_repo_id - + - + text not null - + expiration_time - + - + timestamptz not null - + type - + - + text not null - + domain_history_revision_id - + - + int8 - + grace_period_id - + - + int8 not null - + billing_event_domain_repo_id - + - + text - + billing_recurrence_domain_repo_id - + - + text - + graceperiodhistory_40ccc1f1:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fk7w3cx8d55q8bln80e716tr7b8 graceperiodhistory_40ccc1f1:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fk7w3cx8d55q8bln80e716tr7b8 hosthistory_56210c2:w->host_f21b78de:e - - - - - - - - + + + + + + + + fk_hosthistory_host hosthistory_56210c2:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_history_registrar_id kmssecret_f3b28857 - - + + public.KmsSecret - - + + [table] - + revision_id - + - + int8 not null - + creation_time - + - + timestamptz not null - + encrypted_value - + - + text not null - + crypto_key_version_name - + - + text not null - + secret_name - + - + text not null - + lock_f21d4861 - - + + public.Lock - - + + [table] - + resource_name - + - + text not null - + tld - + - + text not null - + acquired_time - + - + timestamptz not null - + expiration_time - + - + timestamptz not null - + request_log_id - + - + text not null - + premiumentry_b0060b91 - - + + public.PremiumEntry - - + + [table] - + revision_id - + - + int8 not null - + price - + - + numeric(19, 2) not null - + domain_label - + - + text not null - + premiumlist_7c3ea68b - - + + public.PremiumList - - + + [table] - + revision_id - + - + bigserial not null - + - + auto-incremented - + creation_timestamp - + - + timestamptz - + name - + - + text not null - + bloom_filter - + - + bytea not null - + currency - + - + text not null - + premiumentry_b0060b91:w->premiumlist_7c3ea68b:e - - - - - - - - + + + + + + + + fko0gw90lpo1tuee56l0nb6y6g5 rderevision_83396864 - - + + public.RdeRevision - - + + [table] - + tld - + - + text not null - + mode - + - + text not null - + "date" - + - + date not null - + update_timestamp - + - + timestamptz - + revision - + - + int4 not null - + registrarpoc_ab47054d - - + + public.RegistrarPoc - - + + [table] - + email_address - + - + text not null - + allowed_to_set_registry_lock_password - + - + bool not null - + fax_number - + - + text - + gae_user_id - + - + text - + name - + - + text - + phone_number - + - + text - + registry_lock_password_hash - + - + text - + registry_lock_password_salt - + - + text - + types - + - + _text - + visible_in_domain_whois_as_abuse - + - + bool not null - + visible_in_whois_as_admin - + - + bool not null - + visible_in_whois_as_tech - + - + bool not null - + registry_lock_email_address - + - + text - + registrar_id - + - + text not null - + registrarpoc_ab47054d:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_registrar_poc_registrar_id registrylock_ac88663e - - + + public.RegistryLock - - + + [table] - + revision_id - + - + bigserial not null - + - + auto-incremented - + lock_completion_timestamp - + - + timestamptz - + lock_request_timestamp - + - + timestamptz not null - + domain_name - + - + text not null - + is_superuser - + - + bool not null - + registrar_id - + - + text not null - + registrar_poc_id - + - + text - + repo_id - + - + text not null - + verification_code - + - + text not null - + unlock_request_timestamp - + - + timestamptz - + unlock_completion_timestamp - + - + timestamptz - - last_update_timestamp + + last_update_time - + - - timestamptz + + timestamptz not null - + relock_revision_id - + - + int8 - + relock_duration - + - + interval - + registrylock_ac88663e:w->registrylock_ac88663e:e - - - - - - - - + + + + + + + + fk2lhcwpxlnqijr96irylrh1707 reservedentry_1a7b8520 - - + + public.ReservedEntry - - + + [table] - + revision_id - + - + int8 not null - + comment - + - + text - + reservation_type - + - + int4 not null - + domain_label - + - + text not null - + reservedlist_b97c3f1c - - + + public.ReservedList - - + + [table] - + revision_id - + - + bigserial not null - + - + auto-incremented - + creation_timestamp - + - + timestamptz not null - + name - + - + text not null - + should_publish - + - + bool not null - + reservedentry_1a7b8520:w->reservedlist_b97c3f1c:e - - - - - - - - + + + + + + + + fkgq03rk0bt1hb915dnyvd3vnfc serversecret_6cc90f09 - - + + public.ServerSecret - - + + [table] - + secret - + - + uuid not null - + signedmarkrevocationentry_99c39721 - - + + public.SignedMarkRevocationEntry - - + + [table] - + revision_id - + - + int8 not null - + revocation_time - + - + timestamptz not null - + smd_id - + - + text not null - + signedmarkrevocationlist_c5d968fb - - + + public.SignedMarkRevocationList - - + + [table] - + revision_id - + - + bigserial not null - + - + auto-incremented - + creation_time - + - + timestamptz - + signedmarkrevocationentry_99c39721:w->signedmarkrevocationlist_c5d968fb:e - - - - - - - - + + + + + + + + fk5ivlhvs3121yx2li5tqh54u4 spec11threatmatch_a61228a6 - - + + public.Spec11ThreatMatch - - + + [table] - + id - + - + bigserial not null - + - + auto-incremented - + check_date - + - + date not null - + domain_name - + - + text not null - + domain_repo_id - + - + text not null - + registrar_id - + - + text not null - + threat_types - + - + _text not null - + tld - + - + text not null - + sqlreplaycheckpoint_342081b3 - - + + public.SqlReplayCheckpoint - - + + [table] - + revision_id - + - + int8 not null - + last_replay_time - + - + timestamptz not null - + tmchcrl_d282355 - - + + public.TmchCrl - - + + [table] - + certificate_revocations - + - + text not null - + update_timestamp - + - + timestamptz not null - + url - + - + text not null - + transaction_d50389d4 - - + + public.Transaction - - + + [table] - + id - + - + bigserial not null - + - + auto-incremented - + contents - + - + bytea - + @@ -12083,7 +12083,7 @@ td.section {
last_update_time - timestamptz + timestamptz not null
@@ -12756,8 +12756,8 @@ td.section {
- last_update_timestamp - timestamptz + last_update_time + timestamptz not null
diff --git a/db/src/main/resources/sql/flyway.txt b/db/src/main/resources/sql/flyway.txt index fdbf14e20..289a0cfe3 100644 --- a/db/src/main/resources/sql/flyway.txt +++ b/db/src/main/resources/sql/flyway.txt @@ -87,3 +87,4 @@ V86__third_poll_message.sql V87__fix_super_domain_fk.sql V88__transfer_billing_cancellation_history_id.sql V89__host_history_host_deferred.sql +V90__update_timestamp.sql diff --git a/db/src/main/resources/sql/flyway/V90__update_timestamp.sql b/db/src/main/resources/sql/flyway/V90__update_timestamp.sql new file mode 100644 index 000000000..7ae9eda0f --- /dev/null +++ b/db/src/main/resources/sql/flyway/V90__update_timestamp.sql @@ -0,0 +1,23 @@ +-- Copyright 2021 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 "Registrar" ALTER COLUMN "last_update_time" SET NOT NULL; +ALTER TABLE "RegistryLock" RENAME "last_update_timestamp" TO "last_update_time"; +ALTER TABLE "RegistryLock" ALTER COLUMN "last_update_time" SET NOT NULL; + +-- While we're at it, rename some registry-lock fields to follow the same naming pattern +ALTER TABLE "RegistryLock" RENAME "lock_completion_timestamp" TO "lock_completion_time"; +ALTER TABLE "RegistryLock" RENAME "lock_request_timestamp" TO "lock_request_time"; +ALTER TABLE "RegistryLock" RENAME "unlock_completion_timestamp" TO "unlock_completion_time"; +ALTER TABLE "RegistryLock" RENAME "unlock_request_timestamp" TO "unlock_request_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 8e086b6d1..24e40854a 100644 --- a/db/src/main/resources/sql/schema/db-schema.sql.generated +++ b/db/src/main/resources/sql/schema/db-schema.sql.generated @@ -589,7 +589,7 @@ i18n_address_zip text, ip_address_allow_list text[], last_certificate_update_time timestamptz, - last_update_time timestamptz, + last_update_time timestamptz not null, localized_address_city text, localized_address_country_code text, localized_address_state text, @@ -634,15 +634,15 @@ revision_id bigserial not null, domain_name text not null, is_superuser boolean not null, - last_update_timestamp timestamptz, - lock_completion_timestamp timestamptz, - lock_request_timestamp timestamptz not null, + last_update_time timestamptz not null, + lock_completion_time timestamptz, + lock_request_time timestamptz not null, registrar_id text not null, registrar_poc_id text, relock_duration interval, repo_id text not null, - unlock_completion_timestamp timestamptz, - unlock_request_timestamp timestamptz, + unlock_completion_time timestamptz, + unlock_request_time timestamptz, verification_code text not null, relock_revision_id int8, primary key (revision_id) diff --git a/db/src/main/resources/sql/schema/nomulus.golden.sql b/db/src/main/resources/sql/schema/nomulus.golden.sql index 6c2baad19..e22fd4e11 100644 --- a/db/src/main/resources/sql/schema/nomulus.golden.sql +++ b/db/src/main/resources/sql/schema/nomulus.golden.sql @@ -780,7 +780,7 @@ CREATE TABLE public."Registrar" ( i18n_address_zip text, ip_address_allow_list text[], last_certificate_update_time timestamp with time zone, - last_update_time timestamp with time zone, + last_update_time timestamp with time zone NOT NULL, localized_address_city text, localized_address_country_code text, localized_address_state text, @@ -831,17 +831,17 @@ CREATE TABLE public."RegistrarPoc" ( CREATE TABLE public."RegistryLock" ( revision_id bigint NOT NULL, - lock_completion_timestamp timestamp with time zone, - lock_request_timestamp timestamp with time zone NOT NULL, + lock_completion_time timestamp with time zone, + lock_request_time timestamp with time zone NOT NULL, domain_name text NOT NULL, is_superuser boolean NOT NULL, registrar_id text NOT NULL, registrar_poc_id text, repo_id text NOT NULL, verification_code text NOT NULL, - unlock_request_timestamp timestamp with time zone, - unlock_completion_timestamp timestamp with time zone, - last_update_timestamp timestamp with time zone, + unlock_request_time timestamp with time zone, + unlock_completion_time timestamp with time zone, + last_update_time timestamp with time zone NOT NULL, relock_revision_id bigint, relock_duration interval );