From 40eef2a06cfeaac935949b9c99065a95f7c3b0ac Mon Sep 17 00:00:00 2001 From: gbrodman Date: Fri, 30 Oct 2020 17:52:09 -0400 Subject: [PATCH] Add SQL schema and DAO for SignedMarkRevocationList (#850) * Add SQL schema and DAO for SignedMarkRevocationList This gets saved every day so we're not concerned about history, meaning we can dual-write and/or dual-read without concern. The structure here is somewhat similar to the ClaimsListDao and related classes. * Update the DB files --- .../model/smd/SignedMarkRevocationList.java | 168 +- .../smd/SignedMarkRevocationListDao.java | 76 + .../main/resources/META-INF/persistence.xml | 1 + .../smd/SignedMarkRevocationListDaoTest.java | 104 + .../smd/SignedMarkRevocationListTest.java | 14 +- .../integration/SqlIntegrationTestSuite.java | 2 + .../sql/er_diagram/brief_er_diagram.html | 2349 +++++++++-------- .../sql/er_diagram/full_er_diagram.html | 1448 +++++----- db/src/main/resources/sql/flyway.txt | 1 + .../V70__signed_mark_revocation_list.sql | 31 + .../sql/schema/db-schema.sql.generated | 18 + .../resources/sql/schema/nomulus.golden.sql | 71 + 12 files changed, 2548 insertions(+), 1735 deletions(-) create mode 100644 core/src/main/java/google/registry/model/smd/SignedMarkRevocationListDao.java create mode 100644 core/src/test/java/google/registry/model/smd/SignedMarkRevocationListDaoTest.java create mode 100644 db/src/main/resources/sql/flyway/V70__signed_mark_revocation_list.sql diff --git a/core/src/main/java/google/registry/model/smd/SignedMarkRevocationList.java b/core/src/main/java/google/registry/model/smd/SignedMarkRevocationList.java index bed00342b..38cda22c8 100644 --- a/core/src/main/java/google/registry/model/smd/SignedMarkRevocationList.java +++ b/core/src/main/java/google/registry/model/smd/SignedMarkRevocationList.java @@ -28,8 +28,12 @@ import static google.registry.util.DateTimeUtils.isBeforeOrAt; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Supplier; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; +import com.google.common.collect.MapDifference; +import com.google.common.collect.Maps; +import com.google.common.flogger.FluentLogger; import com.googlecode.objectify.Key; import com.googlecode.objectify.annotation.EmbedMap; import com.googlecode.objectify.annotation.Entity; @@ -41,8 +45,19 @@ import google.registry.model.ImmutableObject; import google.registry.model.annotations.NotBackedUp; import google.registry.model.annotations.NotBackedUp.Reason; import google.registry.model.common.EntityGroupRoot; +import google.registry.schema.replay.DatastoreEntity; +import google.registry.schema.replay.SqlEntity; import google.registry.util.CollectionUtils; import java.util.Map; +import java.util.Optional; +import javax.persistence.CollectionTable; +import javax.persistence.Column; +import javax.persistence.ElementCollection; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.JoinColumn; +import javax.persistence.MapKeyColumn; +import javax.persistence.Transient; import org.joda.time.DateTime; /** @@ -56,35 +71,50 @@ import org.joda.time.DateTime; * order to avoid exceeding the one megabyte max entity size limit, we'll also be sharding that * entity into multiple entities, each entity containing {@value #SHARD_SIZE} rows. * + *

TODO: We can remove the sharding once we have converted entirely to Cloud SQL storage during + * the Registry 3.0 migration. Then, the entire table will be stored conceptually as one entity (in + * fact in SignedMarkRevocationList and SignedMarkRevocationEntry tables). + * * @see google.registry.tmch.SmdrlCsvParser - * @see - * TMCH functional specifications - SMD Revocation List + * @see TMCH + * functional specifications - SMD Revocation List */ @Entity +@javax.persistence.Entity @NotBackedUp(reason = Reason.EXTERNALLY_SOURCED) -public class SignedMarkRevocationList extends ImmutableObject { +public class SignedMarkRevocationList extends ImmutableObject + implements DatastoreEntity, SqlEntity { - @VisibleForTesting - static final int SHARD_SIZE = 10000; + private static final FluentLogger logger = FluentLogger.forEnclosingClass(); + + @VisibleForTesting static final int SHARD_SIZE = 10000; /** Common ancestor for queries. */ - @Parent - Key parent = getCrossTldKey(); + @Parent @Transient Key parent = getCrossTldKey(); /** ID for the sharded entity. */ - @Id - long id; + @Id @Transient long id; + + @Ignore + @javax.persistence.Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + Long revisionId; /** Time when this list was last updated, as specified in the first line of the CSV file. */ DateTime creationTime; /** A map from SMD IDs to revocation time. */ @EmbedMap + @ElementCollection + @CollectionTable( + name = "SignedMarkRevocationEntry", + joinColumns = @JoinColumn(name = "revisionId", referencedColumnName = "revisionId")) + @MapKeyColumn(name = "smdId") + @Column(name = "revocationTime", nullable = false) Map revokes; /** Indicates that this is a shard rather than a "full" list. */ - @Ignore - boolean isShard; + @Ignore @Transient boolean isShard; /** * A cached supplier that fetches the SMDRL shards from Datastore and recombines them into a @@ -92,32 +122,16 @@ public class SignedMarkRevocationList extends ImmutableObject { */ private static final Supplier CACHE = memoizeWithShortExpiration( - () -> - tm() - .transactNewReadOnly( - () -> { - Iterable shards = - ofy() - .load() - .type(SignedMarkRevocationList.class) - .ancestor(getCrossTldKey()); - DateTime creationTime = - isEmpty(shards) - ? START_OF_TIME - : checkNotNull( - Iterables.get(shards, 0).creationTime, "creationTime"); - ImmutableMap.Builder revokes = - new ImmutableMap.Builder<>(); - for (SignedMarkRevocationList shard : shards) { - revokes.putAll(shard.revokes); - checkState( - creationTime.equals(shard.creationTime), - "Inconsistent creation times: %s vs. %s", - creationTime, - shard.creationTime); - } - return create(creationTime, revokes.build()); - })); + () -> { + SignedMarkRevocationList datastoreList = loadFromDatastore(); + // Also load the list from Cloud SQL, compare the two lists, and log if different. + try { + loadAndCompareCloudSqlList(datastoreList); + } catch (Throwable t) { + logger.atSevere().withCause(t).log("Error comparing signed mark revocation lists."); + } + return datastoreList; + }); /** Return a single logical instance that combines all Datastore shards. */ public static SignedMarkRevocationList get() { @@ -149,10 +163,39 @@ public class SignedMarkRevocationList extends ImmutableObject { return revokes.size(); } - /** Save this list to Datastore in sharded form. Returns {@code this}. */ + /** Save this list to Datastore in sharded form and to Cloud SQL. Returns {@code this}. */ public SignedMarkRevocationList save() { - tm() - .transact( + saveToDatastore(); + SignedMarkRevocationListDao.trySave(this); + return this; + } + + /** Loads the shards from Datastore and combines them into one list. */ + private static SignedMarkRevocationList loadFromDatastore() { + return tm().transactNewReadOnly( + () -> { + Iterable shards = + ofy().load().type(SignedMarkRevocationList.class).ancestor(getCrossTldKey()); + DateTime creationTime = + isEmpty(shards) + ? START_OF_TIME + : checkNotNull(Iterables.get(shards, 0).creationTime, "creationTime"); + ImmutableMap.Builder revokes = new ImmutableMap.Builder<>(); + for (SignedMarkRevocationList shard : shards) { + revokes.putAll(shard.revokes); + checkState( + creationTime.equals(shard.creationTime), + "Inconsistent creation times: %s vs. %s", + creationTime, + shard.creationTime); + } + return create(creationTime, revokes.build()); + }); + } + + /** Save this list to Datastore in sharded form. */ + private SignedMarkRevocationList saveToDatastore() { + tm().transact( () -> { ofy() .deleteWithoutBackup() @@ -165,8 +208,7 @@ public class SignedMarkRevocationList extends ImmutableObject { ofy() .saveWithoutBackup() .entities( - CollectionUtils.partitionMap(revokes, SHARD_SIZE) - .stream() + CollectionUtils.partitionMap(revokes, SHARD_SIZE).stream() .map( shardRevokes -> { SignedMarkRevocationList shard = create(creationTime, shardRevokes); @@ -180,6 +222,38 @@ public class SignedMarkRevocationList extends ImmutableObject { return this; } + private static void loadAndCompareCloudSqlList(SignedMarkRevocationList datastoreList) { + // Lifted with some modifications from ClaimsListShard + Optional maybeCloudSqlList = + SignedMarkRevocationListDao.getLatestRevision(); + if (maybeCloudSqlList.isPresent()) { + SignedMarkRevocationList cloudSqlList = maybeCloudSqlList.get(); + MapDifference diff = + Maps.difference(datastoreList.revokes, cloudSqlList.revokes); + if (!diff.areEqual()) { + if (diff.entriesDiffering().size() > 10) { + logger.atWarning().log( + String.format( + "Unequal SM revocation lists detected, Cloud SQL list with revision id %d has %d" + + " different records than the current Datastore list.", + cloudSqlList.revisionId, diff.entriesDiffering().size())); + } else { + StringBuilder diffMessage = new StringBuilder("Unequal SM revocation lists detected:\n"); + diff.entriesDiffering() + .forEach( + (label, valueDiff) -> + diffMessage.append( + String.format( + "SMD %s has key %s in Datastore and key %s in Cloud SQL.\n", + label, valueDiff.leftValue(), valueDiff.rightValue()))); + logger.atWarning().log(diffMessage.toString()); + } + } + } else { + logger.atWarning().log("Signed mark revocation list in Cloud SQL is empty."); + } + } + /** As a safety mechanism, fail if someone tries to save this class directly. */ @OnSave void disallowUnshardedSaves() { @@ -188,6 +262,16 @@ public class SignedMarkRevocationList extends ImmutableObject { } } + @Override + public ImmutableList toSqlEntities() { + return ImmutableList.of(); // Dually-written every day + } + + @Override + public ImmutableList toDatastoreEntities() { + return ImmutableList.of(); // Dually-written every day + } + /** Exception when trying to directly save a {@link SignedMarkRevocationList} without sharding. */ public static class UnshardedSaveException extends RuntimeException {} } diff --git a/core/src/main/java/google/registry/model/smd/SignedMarkRevocationListDao.java b/core/src/main/java/google/registry/model/smd/SignedMarkRevocationListDao.java new file mode 100644 index 000000000..2bc7e2e30 --- /dev/null +++ b/core/src/main/java/google/registry/model/smd/SignedMarkRevocationListDao.java @@ -0,0 +1,76 @@ +// Copyright 2020 The Nomulus Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package google.registry.model.smd; + +import static google.registry.model.CacheUtils.memoizeWithShortExpiration; +import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm; + +import com.google.common.base.Supplier; +import com.google.common.flogger.FluentLogger; +import java.util.Optional; +import javax.persistence.EntityManager; + +public class SignedMarkRevocationListDao { + + private static final FluentLogger logger = FluentLogger.forEnclosingClass(); + + private static final Supplier> CACHE = + memoizeWithShortExpiration(SignedMarkRevocationListDao::getLatestRevision); + + /** Returns the most recent revision of the {@link SignedMarkRevocationList}, from cache. */ + public static Optional getLatestRevisionCached() { + return CACHE.get(); + } + + public static Optional getLatestRevision() { + return jpaTm() + .transact( + () -> { + EntityManager em = jpaTm().getEntityManager(); + Long revisionId = + em.createQuery("SELECT MAX(revisionId) FROM SignedMarkRevocationList", Long.class) + .getSingleResult(); + return em.createQuery( + "FROM SignedMarkRevocationList smrl LEFT JOIN FETCH smrl.revokes " + + "WHERE smrl.revisionId = :revisionId", + SignedMarkRevocationList.class) + .setParameter("revisionId", revisionId) + .getResultStream() + .findFirst(); + }); + } + + /** + * Try to save the given {@link SignedMarkRevocationList} into Cloud SQL. If the save fails, the + * error will be logged but no exception will be thrown. + * + *

This method is used during the dual-write phase of database migration as Datastore is still + * the authoritative database. + */ + static void trySave(SignedMarkRevocationList signedMarkRevocationList) { + try { + SignedMarkRevocationListDao.save(signedMarkRevocationList); + logger.atInfo().log( + "Inserted %,d signed mark revocations into Cloud SQL", + signedMarkRevocationList.revokes.size()); + } catch (Throwable e) { + logger.atSevere().withCause(e).log("Error inserting signed mark revocations into Cloud SQL"); + } + } + + private static void save(SignedMarkRevocationList signedMarkRevocationList) { + jpaTm().transact(() -> jpaTm().getEntityManager().persist(signedMarkRevocationList)); + } +} diff --git a/core/src/main/resources/META-INF/persistence.xml b/core/src/main/resources/META-INF/persistence.xml index d614862b4..da7007ac4 100644 --- a/core/src/main/resources/META-INF/persistence.xml +++ b/core/src/main/resources/META-INF/persistence.xml @@ -62,6 +62,7 @@ google.registry.model.registry.Registry google.registry.model.reporting.DomainTransactionRecord google.registry.model.reporting.Spec11ThreatMatch + google.registry.model.smd.SignedMarkRevocationList google.registry.model.tmch.ClaimsListShard google.registry.persistence.transaction.TransactionEntity google.registry.schema.cursor.Cursor diff --git a/core/src/test/java/google/registry/model/smd/SignedMarkRevocationListDaoTest.java b/core/src/test/java/google/registry/model/smd/SignedMarkRevocationListDaoTest.java new file mode 100644 index 000000000..3870137d1 --- /dev/null +++ b/core/src/test/java/google/registry/model/smd/SignedMarkRevocationListDaoTest.java @@ -0,0 +1,104 @@ +// Copyright 2020 The Nomulus Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package google.registry.model.smd; + +import static com.google.common.truth.Truth.assertThat; +import static google.registry.model.ImmutableObjectSubject.assertAboutImmutableObjects; + +import com.google.common.collect.ImmutableMap; +import google.registry.persistence.transaction.JpaTestRules; +import google.registry.persistence.transaction.JpaTestRules.JpaIntegrationWithCoverageExtension; +import google.registry.testing.DatastoreEntityExtension; +import google.registry.testing.DualDatabaseTest; +import google.registry.testing.FakeClock; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +@DualDatabaseTest +public class SignedMarkRevocationListDaoTest { + + private final FakeClock fakeClock = new FakeClock(); + + @RegisterExtension + final JpaIntegrationWithCoverageExtension jpa = + new JpaTestRules.Builder().withClock(fakeClock).buildIntegrationWithCoverageExtension(); + + @RegisterExtension + @Order(value = 1) + final DatastoreEntityExtension datastoreEntityExtension = new DatastoreEntityExtension(); + + @Test + void testSave_success() { + SignedMarkRevocationList list = + SignedMarkRevocationList.create( + fakeClock.nowUtc(), ImmutableMap.of("mark", fakeClock.nowUtc().minusHours(1))); + SignedMarkRevocationListDao.trySave(list); + SignedMarkRevocationList fromDb = SignedMarkRevocationListDao.getLatestRevision().get(); + assertAboutImmutableObjects().that(fromDb).isEqualExceptFields(list); + } + + @Test + void trySave_failureIsSwallowed() { + SignedMarkRevocationList list = + SignedMarkRevocationList.create( + fakeClock.nowUtc(), ImmutableMap.of("mark", fakeClock.nowUtc().minusHours(1))); + SignedMarkRevocationListDao.trySave(list); + SignedMarkRevocationList fromDb = SignedMarkRevocationListDao.getLatestRevision().get(); + assertAboutImmutableObjects().that(fromDb).isEqualExceptFields(list); + + // This should throw an exception, which is swallowed and nothing changed + SignedMarkRevocationListDao.trySave(list); + SignedMarkRevocationList secondFromDb = SignedMarkRevocationListDao.getLatestRevision().get(); + assertAboutImmutableObjects().that(secondFromDb).isEqualExceptFields(fromDb); + } + + @Test + void testRetrieval_notPresent() { + assertThat(SignedMarkRevocationListDao.getLatestRevision().isPresent()).isFalse(); + } + + @Test + void testSaveAndRetrieval_emptyList() { + SignedMarkRevocationList list = + SignedMarkRevocationList.create(fakeClock.nowUtc(), ImmutableMap.of()); + SignedMarkRevocationListDao.trySave(list); + SignedMarkRevocationList fromDb = SignedMarkRevocationListDao.getLatestRevision().get(); + assertAboutImmutableObjects().that(fromDb).isEqualExceptFields(list); + } + + @Test + void testSave_multipleVersions() { + SignedMarkRevocationList list = + SignedMarkRevocationList.create( + fakeClock.nowUtc(), ImmutableMap.of("mark", fakeClock.nowUtc().minusHours(1))); + SignedMarkRevocationListDao.trySave(list); + assertThat( + SignedMarkRevocationListDao.getLatestRevision() + .get() + .isSmdRevoked("mark", fakeClock.nowUtc())) + .isTrue(); + + // Now remove the revocation + SignedMarkRevocationList secondList = + SignedMarkRevocationList.create(fakeClock.nowUtc(), ImmutableMap.of()); + SignedMarkRevocationListDao.trySave(secondList); + assertThat( + SignedMarkRevocationListDao.getLatestRevision() + .get() + .isSmdRevoked("mark", fakeClock.nowUtc())) + .isFalse(); + } +} diff --git a/core/src/test/java/google/registry/model/smd/SignedMarkRevocationListTest.java b/core/src/test/java/google/registry/model/smd/SignedMarkRevocationListTest.java index b9b4a0b35..e4fdde32f 100644 --- a/core/src/test/java/google/registry/model/smd/SignedMarkRevocationListTest.java +++ b/core/src/test/java/google/registry/model/smd/SignedMarkRevocationListTest.java @@ -15,6 +15,7 @@ package google.registry.model.smd; import static com.google.common.truth.Truth.assertThat; +import static google.registry.model.ImmutableObjectSubject.assertAboutImmutableObjects; import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.smd.SignedMarkRevocationList.SHARD_SIZE; import static google.registry.persistence.transaction.TransactionManagerFactory.tm; @@ -72,10 +73,11 @@ public class SignedMarkRevocationListTest { revokes.put(Integer.toString(i), clock.nowUtc()); } // Save it with sharding, and make sure that reloading it works. - SignedMarkRevocationList unsharded = SignedMarkRevocationList - .create(clock.nowUtc(), revokes.build()) - .save(); - assertThat(SignedMarkRevocationList.get()).isEqualTo(unsharded); + SignedMarkRevocationList unsharded = + SignedMarkRevocationList.create(clock.nowUtc(), revokes.build()).save(); + assertAboutImmutableObjects() + .that(SignedMarkRevocationList.get()) + .isEqualExceptFields(unsharded, "revisionId"); assertThat(ofy().load().type(SignedMarkRevocationList.class).count()).isEqualTo(2); } @@ -91,7 +93,9 @@ public class SignedMarkRevocationListTest { SignedMarkRevocationList unsharded = SignedMarkRevocationList .create(clock.nowUtc(), revokes.build()) .save(); - assertThat(SignedMarkRevocationList.get()).isEqualTo(unsharded); + assertAboutImmutableObjects() + .that(SignedMarkRevocationList.get()) + .isEqualExceptFields(unsharded, "revisionId"); assertThat(ofy().load().type(SignedMarkRevocationList.class).count()).isEqualTo(4); } diff --git a/core/src/test/java/google/registry/schema/integration/SqlIntegrationTestSuite.java b/core/src/test/java/google/registry/schema/integration/SqlIntegrationTestSuite.java index 22757d034..24d1e6ca5 100644 --- a/core/src/test/java/google/registry/schema/integration/SqlIntegrationTestSuite.java +++ b/core/src/test/java/google/registry/schema/integration/SqlIntegrationTestSuite.java @@ -29,6 +29,7 @@ import google.registry.model.registry.RegistryLockDaoTest; import google.registry.model.registry.RegistryTest; import google.registry.model.registry.label.ReservedListSqlDaoTest; import google.registry.model.reporting.Spec11ThreatMatchTest; +import google.registry.model.smd.SignedMarkRevocationListDaoTest; import google.registry.model.tmch.ClaimsListDaoTest; import google.registry.persistence.transaction.JpaEntityCoverageExtension; import google.registry.persistence.transaction.JpaTestRules.JpaIntegrationWithCoverageExtension; @@ -92,6 +93,7 @@ import org.junit.runner.RunWith; RegistryTest.class, ReservedListSqlDaoTest.class, RegistryLockDaoTest.class, + SignedMarkRevocationListDaoTest.class, Spec11ThreatMatchTest.class, // AfterSuiteTest must be the last entry. See class javadoc for details. AfterSuiteTest.class 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 4766be2b7..9ab1fcb7c 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,2339 +261,2405 @@ td.section { generated on - 2020-10-29 18:43:32.035191 + 2020-10-30 20:47:04.047621 last flyway file - V69__change_primary_key_and_add_history_table_for_delegation_signer.sql + V70__signed_mark_revocation_list.sql

 

 

- + SchemaCrawler_Diagram - - + + generated by - + SchemaCrawler 16.10.1 - + generated on - - 2020-10-29 18:43:32.035191 + + 2020-10-30 20:47:04.047621 - + allocationtoken_a08ccbef - - + + public.AllocationToken - - + + [table] - + token - + - + text not null - + domain_name - + - + text - + billingcancellation_6eedf614 - - + + public.BillingCancellation - - + + [table] - + billing_cancellation_id - + - + int8 not null - + registrar_id - + - + text not null - + event_time - + - + timestamptz not null - + billing_time - + - + timestamptz - + billing_event_id - + - + int8 - + billing_recurrence_id - + - + int8 - + billingevent_a57d1815 - - + + public.BillingEvent - - + + [table] - + billing_event_id - + - + int8 not null - + registrar_id - + - + text not null - + event_time - + - + timestamptz not null - + allocation_token_id - + - + text - + billing_time - + - + timestamptz - + cancellation_matching_billing_recurrence_id - + - + int8 - + synthetic_creation_time - + - + timestamptz - + billingcancellation_6eedf614:w->billingevent_a57d1815:e - - - - - - - - + + + + + + + + fk_billing_cancellation_billing_event_id billingrecurrence_5fa2cb01 - - + + public.BillingRecurrence - - + + [table] - + billing_recurrence_id - + - + int8 not null - + registrar_id - + - + text not null - + event_time - + - + timestamptz not null - + recurrence_end_time - + - + timestamptz - + recurrence_time_of_year - + - + text - + billingcancellation_6eedf614:w->billingrecurrence_5fa2cb01:e - - - - - - - - + + + + + + + + fk_billing_cancellation_billing_recurrence_id registrar_6e1503e3 - - + + public.Registrar - - + + [table] - + registrar_id - + - + text not null - + iana_identifier - + - + int8 - + registrar_name - + - + text not null - + 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 - + domain_name - + - + text - + tld - + - + text - + admin_contact - + - + text - + billing_contact - + - + text - + registrant_contact - + - + text - + tech_contact - + - + text - + transfer_billing_cancellation_id - + - + int8 - + transfer_billing_event_id - + - + int8 - + transfer_billing_recurrence_id - + - + int8 - + transfer_gaining_registrar_id - + - + text - + transfer_losing_registrar_id - + - + text - + billing_recurrence_id - + - + int8 - + autorenew_poll_message_id - + - + int8 - + deletion_poll_message_id - + - + int8 - + autorenew_end_time - + - + timestamptz - + domain_6c51cffa:w->billingcancellation_6eedf614:e - - - - - - - - + + + + + + + + fk_domain_transfer_billing_cancellation_id domain_6c51cffa:w->billingevent_a57d1815:e - - - - - - - - + + + + + + + + fk_domain_transfer_billing_event_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 - + contact_id - + - + text - + search_name - + - + text - + transfer_gaining_registrar_id - + - + text - + transfer_losing_registrar_id - + - + text - + 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 pollmessage_614a523e - - + + public.PollMessage - - + + [table] - + 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 - + transfer_response_gaining_registrar_id - + - + text - + transfer_response_losing_registrar_id - + - + text - + domain_6c51cffa:w->pollmessage_614a523e:e - - - - - - - - + + + + + + + + fk_domain_autorenew_poll_message_id domain_6c51cffa:w->pollmessage_614a523e:e - - - - - - - - + + + + + + + + fk_domain_deletion_poll_message_id 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 billingevent_a57d1815:w->billingrecurrence_5fa2cb01:e - - - - - - - - + + + + + + + + fk_billing_event_cancellation_matching_billing_recurrence_id billingevent_a57d1815:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_billing_event_registrar_id graceperiod_cd3b2e8f - - + + public.GracePeriod - - + + [table] - + id - + - + int8 not null - + billing_event_id - + - + int8 - + billing_recurrence_id - + - + int8 - + domain_repo_id - + - + text not null - + graceperiod_cd3b2e8f:w->domain_6c51cffa:e - - - - - - - - + + + + + + + + fk_grace_period_domain_repo_id graceperiod_cd3b2e8f:w->billingevent_a57d1815:e - - - - - - - - + + + + + + + + fk_grace_period_billing_event_id graceperiod_cd3b2e8f:w->billingrecurrence_5fa2cb01:e - - - - - - - - + + + + + + + + fk_grace_period_billing_recurrence_id billingrecurrence_5fa2cb01:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk_billing_recurrence_registrar_id claimsentry_105da9f1 - - + + public.ClaimsEntry - - + + [table] - + revision_id - + - + int8 not null - + domain_label - + - + text not null - + claimslist_3d49bc2b - - + + public.ClaimsList - - + + [table] - + revision_id - + - + bigserial not null - + - + auto-incremented - + 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_registrar_id - + - + text - + history_modification_time - + - + timestamptz not null - + history_type - + - + text not null - + creation_time - + - + timestamptz - + contact_repo_id - + - + text not null - + 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: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 domainhistory_a54cc226 - - + + public.DomainHistory - - + + [table] - + history_revision_id - + - + int8 not null - + history_registrar_id - + - + text - + history_modification_time - + - + timestamptz not null - + history_type - + - + text not null - + creation_time - + - + timestamptz - + domain_repo_id - + - + text not null - + 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 - + superordinate_domain - + - + text - + pollmessage_614a523e:w->host_f21b78de:e - - - - - - - - + + + + + + + + fk_poll_message_host_repo_id hosthistory_56210c2 - - + + public.HostHistory - - + + [table] - + history_revision_id - + - + int8 not null - + history_registrar_id - + - + text not null - + history_modification_time - + - + timestamptz not null - + history_type - + - + text not null - + host_name - + - + text - + creation_time - + - + timestamptz - + host_repo_id - + - + text not null - + 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 - + 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 domaindsdatahistory_995b060d - - + + public.DomainDsDataHistory - - + + [table] - + ds_data_history_revision_id - + - + int8 not null - + domain_history_revision_id - + - + int8 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 - + 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 - + domain_repo_id - + - + text - + history_revision_id - + - + int8 - + domaintransactionrecord_6e77ff61:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fkcjqe54u72kha71vkibvxhjye7 domaintransactionrecord_6e77ff61:w->domainhistory_a54cc226:e - - - - - - - - + + + + + + + + fkcjqe54u72kha71vkibvxhjye7 hosthistory_56210c2:w->host_f21b78de:e - - - - - - - - + + + + + + + + fk_hosthistory_host hosthistory_56210c2:w->registrar_6e1503e3:e - - - - - - - - + + + + + + + + fk3d09knnmxrt6iniwnp8j2ykga lock_f21d4861 - - + + public.Lock - - + + [table] - + resource_name - + - + text not null - + tld - + - + text not null - + premiumentry_b0060b91 - - + + public.PremiumEntry - - + + [table] - + revision_id - + - + int8 not null - + domain_label - + - + text not null - + premiumlist_7c3ea68b - - + + public.PremiumList - - + + [table] - + revision_id - + - + bigserial not null - + - + auto-incremented - + name - + - + 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 - + registrarpoc_ab47054d - - + + public.RegistrarPoc - - + + [table] - + email_address - + - + text not null - + gae_user_id - + - + text - + registrar_id - + - + text not null - + registrylock_ac88663e - - + + public.RegistryLock - - + + [table] - + revision_id - + - + bigserial not null - + - + auto-incremented - + registrar_id - + - + text not null - + repo_id - + - + text not null - + verification_code - + - + text not null - + relock_revision_id - + - + int8 - + registrylock_ac88663e:w->registrylock_ac88663e:e - - - - - - - - + + + + + + + + fk2lhcwpxlnqijr96irylrh1707 reservedentry_1a7b8520 - - + + public.ReservedEntry - - + + [table] - + revision_id - + - + int8 not null - + domain_label - + - + text not null - + reservedlist_b97c3f1c - - + + public.ReservedList - - + + [table] - + revision_id - + - + bigserial not null - + - + auto-incremented - + name - + - + text not null - + reservedentry_1a7b8520:w->reservedlist_b97c3f1c:e - - - - - - - - + + + + + + + + fkgq03rk0bt1hb915dnyvd3vnfc - + + signedmarkrevocationentry_99c39721 + + + public.SignedMarkRevocationEntry + + + + [table] + + + revision_id + + + + + int8 not null + + + smd_id + + + + + text not null + + + + + signedmarkrevocationlist_c5d968fb + + + public.SignedMarkRevocationList + + + + [table] + + + revision_id + + + + + bigserial not null + + + + + auto-incremented + + + + + signedmarkrevocationentry_99c39721:w->signedmarkrevocationlist_c5d968fb:e + + + + + + + + + fk5ivlhvs3121yx2li5tqh54u4 + + + spec11threatmatch_a61228a6 - - + + public.Spec11ThreatMatch - - + + [table] - + id - + - + bigserial not null - + - + auto-incremented - + check_date - + - + date not null - + registrar_id - + - + text not null - + tld - + - + text not null - + - + tld_f1fa57e2 - - + + public.Tld - - + + [table] - + tld_name - + - + text not null - + - + transaction_d50389d4 - - + + public.Transaction - - + + [table] - + id - + - + bigserial not null - + - + auto-incremented - + @@ -5554,6 +5620,117 @@ td.section {

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
public.SignedMarkRevocationEntry [table] +
revision_idint8 not null
smd_idtext not null
Primary Key
SignedMarkRevocationEntry_pkey[primary key]
revision_id
smd_id
Foreign Keys
fk5ivlhvs3121yx2li5tqh54u4[foreign key, with no action]
revision_id (0..many)→ public.SignedMarkRevocationList.revision_id
+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
public.SignedMarkRevocationList [table] +
revision_idbigserial not null
auto-incremented
Primary Key
SignedMarkRevocationList_pkey[primary key]
revision_id
Foreign Keys
fk5ivlhvs3121yx2li5tqh54u4[foreign key, with no action]
revision_id ←(0..many) public.SignedMarkRevocationEntry.revision_id
+

 

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 6457e7fa9..c6c3878b7 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,19 +261,19 @@ td.section { - + - +
public.Spec11ThreatMatch [table]
generated on2020-10-29 18:43:30.4664822020-10-30 20:47:02.446335
last flyway fileV69__change_primary_key_and_add_history_table_for_delegation_signer.sqlV70__signed_mark_revocation_list.sql

 

 

- + SchemaCrawler_Diagram - + generated by @@ -284,116 +284,116 @@ td.section { generated on - 2020-10-29 18:43:30.466482 + 2020-10-30 20:47:02.446335 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_history_entry - + - + text - + token_status_transitions - + - + "hstore" - + token_type - + - + text - + billingcancellation_6eedf614 @@ -2336,66 +2336,66 @@ td.section { domain_6c51cffa:w->pollmessage_614a523e:e - - - - - - - + + + + + + + fk_domain_autorenew_poll_message_id domain_6c51cffa:w->pollmessage_614a523e:e - - - - - - - - + + + + + + + + fk_domain_deletion_poll_message_id domain_6c51cffa:w->registrar_6e1503e3:e - - - + + + - + fk2jc69qyg2tv9hhnmif6oa1cx1 domain_6c51cffa:w->registrar_6e1503e3:e - + - + fk2u3srsfbei272093m3b3xwj23 domain_6c51cffa:w->registrar_6e1503e3:e - - - + + + - + fkjc0r9r5y1lfbt4gpbqw4wsuvq @@ -2453,124 +2453,124 @@ td.section { graceperiod_cd3b2e8f - - + + public.GracePeriod - - + + [table] - + 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 - + graceperiod_cd3b2e8f:w->domain_6c51cffa:e - - - - - - - - + + + + + + + + fk_grace_period_domain_repo_id graceperiod_cd3b2e8f:w->billingevent_a57d1815:e - - - - - - - - + + + + + + + + fk_grace_period_billing_event_id graceperiod_cd3b2e8f:w->billingrecurrence_5fa2cb01:e - - - + + + - + fk_grace_period_billing_recurrence_id @@ -2679,12 +2679,12 @@ td.section { contact_8de8cb16:w->registrar_6e1503e3:e - + - + fk1sfyj7o7954prbn1exk7lpnoe @@ -2692,53 +2692,53 @@ td.section { 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 @@ -4362,79 +4362,79 @@ td.section { 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 @@ -4453,40 +4453,40 @@ td.section { domainhost_1ea127c2 - - + + public.DomainHost - - + + [table] - + domain_repo_id - + - + text not null - + host_repo_id - + - + text - + domainhost_1ea127c2:w->domain_6c51cffa:e - - - + + + - + fkfmi7bdink53swivs390m2btxg @@ -4494,9 +4494,9 @@ td.section { domainhost_1ea127c2:w->host_f21b78de:e - - - + + + @@ -4507,14 +4507,14 @@ td.section { host_f21b78de:w->domain_6c51cffa:e - + - + fk_host_superordinate_domain @@ -4663,14 +4663,14 @@ td.section { domainhistoryhost_9f3f23ee:w->domainhistory_a54cc226:e - + - + - + fka9woh3hu8gx5x0vly6bai327n @@ -4749,27 +4749,27 @@ td.section { domaintransactionrecord_6e77ff61:w->domainhistory_a54cc226:e - - + + - + - + fkcjqe54u72kha71vkibvxhjye7 domaintransactionrecord_6e77ff61:w->domainhistory_a54cc226:e - - - + + + - + fkcjqe54u72kha71vkibvxhjye7 @@ -5380,428 +5380,510 @@ td.section { fkgq03rk0bt1hb915dnyvd3vnfc - + - spec11threatmatch_a61228a6 - - - public.Spec11ThreatMatch + signedmarkrevocationentry_99c39721 + + + public.SignedMarkRevocationEntry - - + + [table] - - id + + revision_id - + - - bigserial not null + + int8 not null - + + revocation_time - - 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 - - - - - 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 + + smd_id - + - - numeric(19, 2) + + text not null - - create_billing_cost_currency + + + + signedmarkrevocationlist_c5d968fb + + + public.SignedMarkRevocationList - + + + [table] - - text + + revision_id - + + + + bigserial not null + + + + + auto-incremented + + 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 - - - + + + + timestamptz + + + + + signedmarkrevocationentry_99c39721:w->signedmarkrevocationlist_c5d968fb:e + + + + + + + + + fk5ivlhvs3121yx2li5tqh54u4 + + - transaction_d50389d4 - - - public.Transaction + 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 + + + + + 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 + + + + + transaction_d50389d4 + + + public.Transaction + + + + [table] + + + id + + + + + bigserial not null + + + + + auto-incremented + + contents - + - + bytea - + @@ -11716,6 +11798,168 @@ td.section {

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
public.SignedMarkRevocationEntry [table] +
revision_idint8 not null
revocation_timetimestamptz not null
smd_idtext not null
Primary Key
SignedMarkRevocationEntry_pkey[primary key]
revision_id
smd_id
Foreign Keys
fk5ivlhvs3121yx2li5tqh54u4[foreign key, with no action]
revision_id (0..many)→ public.SignedMarkRevocationList.revision_id
Indexes
SignedMarkRevocationEntry_pkey[unique index]
revision_idascending
smd_idascending
+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
public.SignedMarkRevocationList [table] +
revision_idbigserial not null
auto-incremented
creation_timetimestamptz
Primary Key
SignedMarkRevocationList_pkey[primary key]
revision_id
Foreign Keys
fk5ivlhvs3121yx2li5tqh54u4[foreign key, with no action]
revision_id ←(0..many) public.SignedMarkRevocationEntry.revision_id
Indexes
SignedMarkRevocationList_pkey[unique index]
revision_idascending
+

 

diff --git a/db/src/main/resources/sql/flyway.txt b/db/src/main/resources/sql/flyway.txt index 7d27ba881..8786dedf6 100644 --- a/db/src/main/resources/sql/flyway.txt +++ b/db/src/main/resources/sql/flyway.txt @@ -67,3 +67,4 @@ V66__create_rde_revision.sql V67__grace_period_history_ids.sql V68__make_reserved_list_nullable_in_registry.sql V69__change_primary_key_and_add_history_table_for_delegation_signer.sql +V70__signed_mark_revocation_list.sql diff --git a/db/src/main/resources/sql/flyway/V70__signed_mark_revocation_list.sql b/db/src/main/resources/sql/flyway/V70__signed_mark_revocation_list.sql new file mode 100644 index 000000000..04543ed60 --- /dev/null +++ b/db/src/main/resources/sql/flyway/V70__signed_mark_revocation_list.sql @@ -0,0 +1,31 @@ +-- Copyright 2020 The Nomulus Authors. All Rights Reserved. +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. + +create table "SignedMarkRevocationEntry" ( + revision_id int8 not null, + revocation_time timestamptz not null, + smd_id text not null, + primary key (revision_id, smd_id) +); + +create table "SignedMarkRevocationList" ( + revision_id bigserial not null, + creation_time timestamptz, + primary key (revision_id) +); + +alter table if exists "SignedMarkRevocationEntry" + add constraint FK5ivlhvs3121yx2li5tqh54u4 + foreign key (revision_id) + references "SignedMarkRevocationList"; 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 dddd0fd20..4ab776dbc 100644 --- a/db/src/main/resources/sql/schema/db-schema.sql.generated +++ b/db/src/main/resources/sql/schema/db-schema.sql.generated @@ -617,6 +617,19 @@ primary key (revision_id) ); + create table "SignedMarkRevocationEntry" ( + revision_id int8 not null, + revocation_time timestamptz not null, + smd_id text not null, + primary key (revision_id, smd_id) + ); + + create table "SignedMarkRevocationList" ( + revision_id bigserial not null, + creation_time timestamptz, + primary key (revision_id) + ); + create table "Spec11ThreatMatch" ( id bigserial not null, check_date date not null, @@ -779,3 +792,8 @@ create index spec11threatmatch_check_date_idx on "Spec11ThreatMatch" (check_date add constraint FKgq03rk0bt1hb915dnyvd3vnfc foreign key (revision_id) references "ReservedList"; + + alter table if exists "SignedMarkRevocationEntry" + add constraint FK5ivlhvs3121yx2li5tqh54u4 + foreign key (revision_id) + references "SignedMarkRevocationList"; diff --git a/db/src/main/resources/sql/schema/nomulus.golden.sql b/db/src/main/resources/sql/schema/nomulus.golden.sql index 26ef82190..3d6f5495b 100644 --- a/db/src/main/resources/sql/schema/nomulus.golden.sql +++ b/db/src/main/resources/sql/schema/nomulus.golden.sql @@ -886,6 +886,46 @@ CREATE SEQUENCE public."SafeBrowsingThreat_id_seq" ALTER SEQUENCE public."SafeBrowsingThreat_id_seq" OWNED BY public."Spec11ThreatMatch".id; +-- +-- Name: SignedMarkRevocationEntry; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public."SignedMarkRevocationEntry" ( + revision_id bigint NOT NULL, + revocation_time timestamp with time zone NOT NULL, + smd_id text NOT NULL +); + + +-- +-- Name: SignedMarkRevocationList; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public."SignedMarkRevocationList" ( + revision_id bigint NOT NULL, + creation_time timestamp with time zone +); + + +-- +-- Name: SignedMarkRevocationList_revision_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public."SignedMarkRevocationList_revision_id_seq" + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: SignedMarkRevocationList_revision_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public."SignedMarkRevocationList_revision_id_seq" OWNED BY public."SignedMarkRevocationList".revision_id; + + -- -- Name: Tld; Type: TABLE; Schema: public; Owner: - -- @@ -996,6 +1036,13 @@ ALTER TABLE ONLY public."RegistryLock" ALTER COLUMN revision_id SET DEFAULT next ALTER TABLE ONLY public."ReservedList" ALTER COLUMN revision_id SET DEFAULT nextval('public."ReservedList_revision_id_seq"'::regclass); +-- +-- Name: SignedMarkRevocationList revision_id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public."SignedMarkRevocationList" ALTER COLUMN revision_id SET DEFAULT nextval('public."SignedMarkRevocationList_revision_id_seq"'::regclass); + + -- -- Name: Spec11ThreatMatch id; Type: DEFAULT; Schema: public; Owner: - -- @@ -1234,6 +1281,22 @@ ALTER TABLE ONLY public."Spec11ThreatMatch" ADD CONSTRAINT "SafeBrowsingThreat_pkey" PRIMARY KEY (id); +-- +-- Name: SignedMarkRevocationEntry SignedMarkRevocationEntry_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public."SignedMarkRevocationEntry" + ADD CONSTRAINT "SignedMarkRevocationEntry_pkey" PRIMARY KEY (revision_id, smd_id); + + +-- +-- Name: SignedMarkRevocationList SignedMarkRevocationList_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public."SignedMarkRevocationList" + ADD CONSTRAINT "SignedMarkRevocationList_pkey" PRIMARY KEY (revision_id); + + -- -- Name: Tld Tld_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -1655,6 +1718,14 @@ 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: - +-- + +ALTER TABLE ONLY public."SignedMarkRevocationEntry" + ADD CONSTRAINT fk5ivlhvs3121yx2li5tqh54u4 FOREIGN KEY (revision_id) REFERENCES public."SignedMarkRevocationList"(revision_id); + + -- -- Name: ClaimsEntry fk6sc6at5hedffc0nhdcab6ivuq; Type: FK CONSTRAINT; Schema: public; Owner: - --
public.Spec11ThreatMatch [table]