Add replay to remaining (non-trivial) flow tests (#1020)

* Add replay to remaining (non-trivial) flow tests

Convert all remaining flow tests to do replay/compare testing.  In the course
of this:
- Move the class specific SetClock extension into its own place.
- Fix another "cyclic" foreign key (there may be another solution in this case
  because HostHistory is actually different from HistoryEntry, but that would
  require changing the way we establish priority since HostHistory is not
  distinguished from HistoryEntry in the current methodology)
This commit is contained in:
Michael Muller 2021-03-19 13:20:53 -04:00 committed by GitHub
parent 5befc142f5
commit c827ea033a
18 changed files with 178 additions and 75 deletions

View file

@ -42,12 +42,19 @@ import google.registry.model.contact.PostalInfo;
import google.registry.model.contact.PostalInfo.Type;
import google.registry.model.eppcommon.StatusValue;
import google.registry.testing.DualDatabaseTest;
import google.registry.testing.ReplayExtension;
import google.registry.testing.TestOfyAndSql;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link ContactUpdateFlow}. */
@DualDatabaseTest
class ContactUpdateFlowTest extends ResourceFlowTestCase<ContactUpdateFlow, ContactResource> {
@Order(value = Order.DEFAULT - 2)
@RegisterExtension
final ReplayExtension replayExtension = ReplayExtension.createWithCompare(clock);
ContactUpdateFlowTest() {
setEppInput("contact_update.xml");
}

View file

@ -72,6 +72,7 @@ import google.registry.model.registry.Registry.TldState;
import google.registry.model.registry.label.ReservedList;
import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.ReplayExtension;
import google.registry.testing.SetClockExtension;
import org.joda.money.CurrencyUnit;
import org.joda.money.Money;
import org.joda.time.DateTime;
@ -79,8 +80,6 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link DomainCheckFlow}. */
@ -88,7 +87,7 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
@Order(value = Order.DEFAULT - 3)
@RegisterExtension
final SetClockExtension setClockExtension = new SetClockExtension();
final SetClockExtension setClockExtension = new SetClockExtension(clock, "2009-01-01T10:00:00Z");
@Order(value = Order.DEFAULT - 2)
@RegisterExtension
@ -1351,12 +1350,4 @@ class DomainCheckFlowTest extends ResourceCheckFlowTestCase<DomainCheckFlow, Dom
.setStatusValues(ImmutableSet.of(StatusValue.PENDING_DELETE))
.build());
}
class SetClockExtension implements BeforeEachCallback {
@Override
public void beforeEach(ExtensionContext context) {
// Kick the clock back to before the earliest date that we set the clock to.
clock.setTo(DateTime.parse("2009-01-01T10:00:00Z"));
}
}
}

View file

@ -66,12 +66,11 @@ import google.registry.model.reporting.HistoryEntry;
import google.registry.persistence.VKey;
import google.registry.testing.AppEngineExtension;
import google.registry.testing.ReplayExtension;
import google.registry.testing.SetClockExtension;
import org.joda.time.DateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link DomainInfoFlow}. */
@ -79,7 +78,8 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, DomainBase
@Order(value = Order.DEFAULT - 3)
@RegisterExtension
final SetClockExtension setClockExtension = new SetClockExtension();
final SetClockExtension setClockExtension =
new SetClockExtension(clock, "2005-03-03T22:00:00.000Z");
@Order(value = Order.DEFAULT - 2)
@RegisterExtension
@ -973,12 +973,4 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, DomainBase
assertIcannReportingActivityFieldLogged("srs-dom-info");
assertTldsFieldLogged("tld");
}
class SetClockExtension implements BeforeEachCallback {
@Override
public void beforeEach(ExtensionContext context) {
// Kick the clock back to before the earliest date that we set the clock to.
clock.setTo(DateTime.parse("2005-03-03T22:00:00.000Z"));
}
}
}

View file

@ -71,6 +71,7 @@ import google.registry.model.reporting.DomainTransactionRecord;
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.ReplayExtension;
import google.registry.testing.SetClockExtension;
import java.util.Map;
import org.joda.money.Money;
import org.joda.time.DateTime;
@ -78,8 +79,6 @@ import org.joda.time.Duration;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link DomainRenewFlow}. */
@ -104,7 +103,8 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, DomainBa
@Order(value = Order.DEFAULT - 3)
@RegisterExtension
final SetClockExtension setClockExtension = new SetClockExtension();
final SetClockExtension setClockExtension =
new SetClockExtension(clock, expirationTime.minusMillis(20));
@Order(value = Order.DEFAULT - 2)
@RegisterExtension
@ -812,21 +812,4 @@ class DomainRenewFlowTest extends ResourceFlowTestCase<DomainRenewFlow, DomainBa
TransactionReportField.netRenewsFieldFromYears(5),
1));
}
/**
* Local extension so we can set the clock correctly prior to using it to define basic entities in
* AppEngineExtension.
*
* <p>This has to happen first, we'll get timestamp inversions if we try to set the clock after
* these objects are created.
*/
class SetClockExtension implements BeforeEachCallback {
@Override
public void beforeEach(ExtensionContext context) {
// we have to go far enough back before the expiration time so that the clock advances we do
// after each persist don't move us into a grace period. The current value is likely beyond
// what is necessary, but this doesn't hurt.
clock.setTo(expirationTime.minusMillis(20));
}
}
}

View file

@ -55,13 +55,20 @@ import google.registry.model.eppcommon.StatusValue;
import google.registry.model.host.HostResource;
import google.registry.model.reporting.HistoryEntry;
import google.registry.testing.DualDatabaseTest;
import google.registry.testing.ReplayExtension;
import google.registry.testing.TestOfyAndSql;
import org.joda.time.DateTime;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link HostCreateFlow}. */
@DualDatabaseTest
class HostCreateFlowTest extends ResourceFlowTestCase<HostCreateFlow, HostResource> {
@Order(value = Order.DEFAULT - 2)
@RegisterExtension
final ReplayExtension replayExtension = ReplayExtension.createWithCompare(clock);
private void setEppHostCreateInput(String hostName, String hostAddrs) {
setEppInput(
"host_create.xml",

View file

@ -47,14 +47,21 @@ import google.registry.model.reporting.HistoryEntry;
import google.registry.model.transfer.DomainTransferData;
import google.registry.model.transfer.TransferStatus;
import google.registry.testing.DualDatabaseTest;
import google.registry.testing.ReplayExtension;
import google.registry.testing.TestOfyAndSql;
import org.joda.time.DateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link HostDeleteFlow}. */
@DualDatabaseTest
class HostDeleteFlowTest extends ResourceFlowTestCase<HostDeleteFlow, HostResource> {
@Order(value = Order.DEFAULT - 2)
@RegisterExtension
final ReplayExtension replayExtension = ReplayExtension.createWithCompare(clock);
@BeforeEach
void initFlowTest() {
setEppInput("host_delete.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld"));

View file

@ -18,6 +18,7 @@ import static com.google.common.truth.Truth.assertThat;
import static google.registry.testing.DatabaseHelper.assertNoBillingEvents;
import static google.registry.testing.DatabaseHelper.createTld;
import static google.registry.testing.DatabaseHelper.newDomainBase;
import static google.registry.testing.DatabaseHelper.persistNewRegistrar;
import static google.registry.testing.DatabaseHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -34,14 +35,21 @@ import google.registry.flows.host.HostFlowUtils.HostNameNotPunyCodedException;
import google.registry.model.domain.DomainBase;
import google.registry.model.eppcommon.StatusValue;
import google.registry.model.host.HostResource;
import google.registry.testing.ReplayExtension;
import javax.annotation.Nullable;
import org.joda.time.DateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link HostInfoFlow}. */
class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostResource> {
@Order(value = Order.DEFAULT - 2)
@RegisterExtension
final ReplayExtension replayExtension = ReplayExtension.createWithCompare(clock);
HostInfoFlowTest() {
setEppInput("host_info.xml", ImmutableMap.of("HOSTNAME", "ns1.example.tld"));
}
@ -105,6 +113,7 @@ class HostInfoFlowTest extends ResourceFlowTestCase<HostInfoFlow, HostResource>
private void runTest_superordinateDomain(
DateTime domainTransferTime, @Nullable DateTime lastSuperordinateChange) throws Exception {
persistNewRegistrar("superclientid");
DomainBase domain =
persistResource(
newDomainBase("parent.foobar")

View file

@ -79,15 +79,22 @@ import google.registry.model.reporting.HistoryEntry;
import google.registry.model.transfer.DomainTransferData;
import google.registry.model.transfer.TransferStatus;
import google.registry.testing.DualDatabaseTest;
import google.registry.testing.ReplayExtension;
import google.registry.testing.TaskQueueHelper.TaskMatcher;
import google.registry.testing.TestOfyAndSql;
import javax.annotation.Nullable;
import org.joda.time.DateTime;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link HostUpdateFlow}. */
@DualDatabaseTest
class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResource> {
@Order(value = Order.DEFAULT - 2)
@RegisterExtension
final ReplayExtension replayExtension = ReplayExtension.createWithCompare(clock);
private void setEppHostUpdateInput(
String oldHostName, String newHostName, String ipOrStatusToAdd, String ipOrStatusToRem) {
setEppInput(
@ -712,6 +719,7 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
.build());
clock.advanceOneMilli();
HostResource renamedHost = doSuccessfulTest();
clock.advanceOneMilli();
persistResource(domain.asBuilder().setLastTransferTime(clock.nowUtc().minusDays(1)).build());
// The last transfer time should be what was on the superordinate domain at the time of the host
// update, not what it is later changed to.
@ -721,7 +729,9 @@ class HostUpdateFlowTest extends ResourceFlowTestCase<HostUpdateFlow, HostResour
.and()
.hasLastTransferTime(lastTransferTime)
.and()
.hasLastSuperordinateChange(clock.nowUtc());
// Need to add two milliseconds to account for the increment of "persist resource" and the
// artificial increment introduced after the flow itself.
.hasLastSuperordinateChange(clock.nowUtc().minusMillis(2));
}
@TestOfyAndSql

View file

@ -32,13 +32,20 @@ import google.registry.flows.poll.PollAckFlow.NotAuthorizedToAckMessageException
import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DomainBase;
import google.registry.model.poll.PollMessage;
import google.registry.testing.ReplayExtension;
import org.joda.time.DateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link PollAckFlow}. */
class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
@Order(value = Order.DEFAULT - 2)
@RegisterExtension
final ReplayExtension replayExtension = ReplayExtension.createWithCompare(clock);
/** This is the message id being sent in the ACK request. */
private static final long MESSAGE_ID = 3;

View file

@ -19,6 +19,7 @@ import static google.registry.testing.DatabaseHelper.createTld;
import static google.registry.testing.DatabaseHelper.newDomainBase;
import static google.registry.testing.DatabaseHelper.persistActiveContact;
import static google.registry.testing.DatabaseHelper.persistActiveHost;
import static google.registry.testing.DatabaseHelper.persistNewRegistrar;
import static google.registry.testing.DatabaseHelper.persistResource;
import static google.registry.testing.EppExceptionSubject.assertAboutEppExceptions;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -37,13 +38,24 @@ import google.registry.model.reporting.HistoryEntry;
import google.registry.model.transfer.TransferResponse.ContactTransferResponse;
import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
import google.registry.model.transfer.TransferStatus;
import org.joda.time.DateTime;
import google.registry.testing.ReplayExtension;
import google.registry.testing.SetClockExtension;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
/** Unit tests for {@link PollRequestFlow}. */
class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
@Order(value = Order.DEFAULT - 3)
@RegisterExtension
final SetClockExtension setClockExtension = new SetClockExtension(clock, "2011-01-02T01:01:01Z");
@Order(value = Order.DEFAULT - 2)
@RegisterExtension
final ReplayExtension replayExtension = ReplayExtension.createWithCompare(clock);
private DomainBase domain;
private ContactResource contact;
private HostResource host;
@ -52,8 +64,8 @@ class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
void setUp() {
setEppInput("poll.xml");
setClientIdForFlow("NewRegistrar");
clock.setTo(DateTime.parse("2011-01-02T01:01:01Z"));
createTld("example");
persistNewRegistrar("BadRegistrar");
contact = persistActiveContact("jd1234");
domain = persistResource(newDomainBase("test.example", contact));
host = persistActiveHost("ns1.test.example");
@ -97,7 +109,6 @@ class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
@Test
void testSuccess_contactTransferPending() throws Exception {
clock.setTo(DateTime.parse("2000-06-13T22:00:00.0Z"));
setClientIdForFlow("TheRegistrar");
persistResource(
new PollMessage.OneTime.Builder()
@ -157,7 +168,7 @@ class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
void testSuccess_wrongRegistrar() throws Exception {
persistResource(
new PollMessage.OneTime.Builder()
.setClientId("different client id")
.setClientId("BadRegistrar")
.setEventTime(clock.nowUtc().minusDays(1))
.setMsg("Poll message")
.setParent(createHistoryEntryForEppResource(domain))
@ -229,6 +240,7 @@ class PollRequestFlowTest extends FlowTestCase<PollRequestFlow> {
.setParent(historyEntry)
.setEventTime(clock.nowUtc().minusDays(1))
.build());
clock.advanceOneMilli();
assertTransactionalFlow(false);
runFlowAssertResponse(loadFile("poll_response_host_delete.xml"));
}

View file

@ -1168,7 +1168,12 @@ public class DatabaseHelper {
public static <T extends EppResource> HistoryEntry createHistoryEntryForEppResource(
T parentResource) {
return persistResource(new HistoryEntry.Builder().setParent(parentResource).build());
return persistResource(
new HistoryEntry.Builder()
.setType(getHistoryEntryType(parentResource))
.setModificationTime(DateTime.now(DateTimeZone.UTC))
.setParent(parentResource)
.build());
}
/** Persists a single Objectify resource, without adjusting foreign resources or keys. */

View file

@ -0,0 +1,47 @@
// 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.
package google.registry.testing;
import org.joda.time.DateTime;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
/**
* Extension used for tests that a) set the clock to a specific time and b) make use of
* ReplayExtension or any other test feature that requires writing to a commit log from test
* utilities that aren't controlled by the ultimate test class (e.g. AppEngineExtension).
*/
public class SetClockExtension implements BeforeEachCallback {
private FakeClock clock;
private DateTime dateTime;
/** Construct from a DateTime, that being the time to set the clock to. */
public SetClockExtension(FakeClock clock, DateTime dateTime) {
this.clock = clock;
this.dateTime = dateTime;
}
/** Construct from a dateTime (the time to set the clock to) represented as a string. */
public SetClockExtension(FakeClock clock, String dateTime) {
this.clock = clock;
this.dateTime = DateTime.parse(dateTime);
}
@Override
public void beforeEach(ExtensionContext context) {
clock.setTo(dateTime);
}
}

View file

@ -3,8 +3,8 @@
<result code="1301">
<msg>Command completed successfully; ack to dequeue</msg>
</result>
<msgQ count="1" id="2-2-ROID-5-3-2000">
<qDate>2000-06-08T22:00:00Z</qDate>
<msgQ count="1" id="2-2-ROID-5-3-2010">
<qDate>2010-12-28T01:01:01Z</qDate>
<msg>Transfer requested.</msg>
</msgQ>
<resData>
@ -12,9 +12,9 @@
<contact:id>sh8013</contact:id>
<contact:trStatus>pending</contact:trStatus>
<contact:reID>TheRegistrar</contact:reID>
<contact:reDate>2000-06-08T22:00:00.0Z</contact:reDate>
<contact:reDate>2010-12-28T01:01:01Z</contact:reDate>
<contact:acID>NewRegistrar</contact:acID>
<contact:acDate>2000-06-13T22:00:00.0Z</contact:acDate>
<contact:acDate>2011-01-02T01:01:01Z</contact:acDate>
</contact:trnData>
</resData>
<trID>

View file

@ -261,11 +261,11 @@ td.section {
</tr>
<tr>
<td class="property_name">generated on</td>
<td class="property_value">2021-03-18 19:08:16.381352</td>
<td class="property_value">2021-03-19 12:31:33.396532</td>
</tr>
<tr>
<td class="property_name">last flyway file</td>
<td id="lastFlywayFile" class="property_value">V88__transfer_billing_cancellation_history_id.sql</td>
<td id="lastFlywayFile" class="property_value">V89__host_history_host_deferred.sql</td>
</tr>
</tbody>
</table>
@ -284,7 +284,7 @@ td.section {
generated on
</text>
<text text-anchor="start" x="4027.94" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
2021-03-18 19:08:16.381352
2021-03-19 12:31:33.396532
</text>
<polygon fill="none" stroke="#888888" points="3940.44,-4 3940.44,-44 4205.44,-44 4205.44,-4 3940.44,-4" /> <!-- allocationtoken_a08ccbef -->
<g id="node1" class="node">
@ -2484,8 +2484,8 @@ td.section {
<polyline fill="none" stroke="black" points="191.5,-646.68 195.4,-643.55 " />
<polygon fill="black" stroke="black" points="199.31,-646.82 193.05,-639.02 194.61,-637.77 200.87,-645.57 199.31,-646.82" />
<polyline fill="none" stroke="black" points="195.4,-643.55 199.3,-640.42 " />
<text text-anchor="start" x="1178.5" y="-280.48" font-family="Helvetica,sans-Serif" font-size="14.00">
fk3d09knnmxrt6iniwnp8j2ykga
<text text-anchor="start" x="1203" y="-280.48" font-family="Helvetica,sans-Serif" font-size="14.00">
fk_history_registrar_id
</text>
</g> <!-- kmssecret_f3b28857 -->
<g id="node22" class="node">
@ -5357,7 +5357,7 @@ td.section {
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2" class="name">fk3d09knnmxrt6iniwnp8j2ykga</td>
<td colspan="2" class="name">fk_history_registrar_id</td>
<td class="description right">[foreign key, with no action]</td>
</tr>
<tr>
@ -6110,7 +6110,7 @@ td.section {
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2" class="name">fk3d09knnmxrt6iniwnp8j2ykga</td>
<td colspan="2" class="name">fk_history_registrar_id</td>
<td class="description right">[foreign key, with no action]</td>
</tr>
<tr>

View file

@ -261,11 +261,11 @@ td.section {
</tr>
<tr>
<td class="property_name">generated on</td>
<td class="property_value">2021-03-18 19:08:14.574191</td>
<td class="property_value">2021-03-19 12:31:31.233378</td>
</tr>
<tr>
<td class="property_name">last flyway file</td>
<td id="lastFlywayFile" class="property_value">V88__transfer_billing_cancellation_history_id.sql</td>
<td id="lastFlywayFile" class="property_value">V89__host_history_host_deferred.sql</td>
</tr>
</tbody>
</table>
@ -284,7 +284,7 @@ td.section {
generated on
</text>
<text text-anchor="start" x="4626.68" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">
2021-03-18 19:08:14.574191
2021-03-19 12:31:31.233378
</text>
<polygon fill="none" stroke="#888888" points="4539.18,-4 4539.18,-44 4804.18,-44 4804.18,-4 4539.18,-4" /> <!-- allocationtoken_a08ccbef -->
<g id="node1" class="node">
@ -5580,8 +5580,8 @@ td.section {
<polyline fill="none" stroke="black" points="298,-1144.89 302.29,-1142.32 " />
<polygon fill="black" stroke="black" points="305.72,-1146.1 300.58,-1137.52 302.3,-1136.49 307.43,-1145.08 305.72,-1146.1" />
<polyline fill="none" stroke="black" points="302.29,-1142.32 306.58,-1139.76 " />
<text text-anchor="start" x="1422" y="-485.69" font-family="Helvetica,sans-Serif" font-size="14.00">
fk3d09knnmxrt6iniwnp8j2ykga
<text text-anchor="start" x="1446.5" y="-485.69" font-family="Helvetica,sans-Serif" font-size="14.00">
fk_history_registrar_id
</text>
</g> <!-- kmssecret_f3b28857 -->
<g id="node22" class="node">
@ -11079,7 +11079,7 @@ td.section {
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2" class="name">fk3d09knnmxrt6iniwnp8j2ykga</td>
<td colspan="2" class="name">fk_history_registrar_id</td>
<td class="description right">[foreign key, with no action]</td>
</tr>
<tr>
@ -12436,7 +12436,7 @@ td.section {
<td colspan="3"></td>
</tr>
<tr>
<td colspan="2" class="name">fk3d09knnmxrt6iniwnp8j2ykga</td>
<td colspan="2" class="name">fk_history_registrar_id</td>
<td class="description right">[foreign key, with no action]</td>
</tr>
<tr>

View file

@ -86,3 +86,4 @@ V85__add_required_columns_in_transfer_data.sql
V86__third_poll_message.sql
V87__fix_super_domain_fk.sql
V88__transfer_billing_cancellation_history_id.sql
V89__host_history_host_deferred.sql

View file

@ -0,0 +1,25 @@
-- 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 "HostHistory" DROP CONSTRAINT fk3d09knnmxrt6iniwnp8j2ykga;
ALTER TABLE "HostHistory" DROP CONSTRAINT fk_hosthistory_host;
ALTER TABLE "HostHistory" ADD CONSTRAINT fk_history_registrar_id
FOREIGN KEY (history_registrar_id)
REFERENCES "Registrar"(registrar_id)
DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE "HostHistory" ADD CONSTRAINT fk_hosthistory_host
FOREIGN KEY (host_repo_id)
REFERENCES "Host"(repo_id)
DEFERRABLE INITIALLY DEFERRED;

View file

@ -1867,14 +1867,6 @@ ALTER TABLE ONLY public."Domain"
ADD CONSTRAINT fk2u3srsfbei272093m3b3xwj23 FOREIGN KEY (current_sponsor_registrar_id) REFERENCES public."Registrar"(registrar_id);
--
-- Name: HostHistory fk3d09knnmxrt6iniwnp8j2ykga; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."HostHistory"
ADD CONSTRAINT fk3d09knnmxrt6iniwnp8j2ykga FOREIGN KEY (history_registrar_id) REFERENCES public."Registrar"(registrar_id);
--
-- Name: SignedMarkRevocationEntry fk5ivlhvs3121yx2li5tqh54u4; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@ -2171,6 +2163,14 @@ ALTER TABLE ONLY public."GracePeriod"
ADD CONSTRAINT fk_grace_period_registrar_id FOREIGN KEY (registrar_id) REFERENCES public."Registrar"(registrar_id);
--
-- Name: HostHistory fk_history_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."HostHistory"
ADD CONSTRAINT fk_history_registrar_id FOREIGN KEY (history_registrar_id) REFERENCES public."Registrar"(registrar_id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: Host fk_host_creation_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
@ -2208,7 +2208,7 @@ ALTER TABLE ONLY public."Host"
--
ALTER TABLE ONLY public."HostHistory"
ADD CONSTRAINT fk_hosthistory_host FOREIGN KEY (host_repo_id) REFERENCES public."Host"(repo_id);
ADD CONSTRAINT fk_hosthistory_host FOREIGN KEY (host_repo_id) REFERENCES public."Host"(repo_id) DEFERRABLE INITIALLY DEFERRED;
--