Generate sql schema for PollMessage (#582)

* Generate sql schema for PollMessage

* Rework columns and resolve comments

* Fix datastore schema
This commit is contained in:
Shicong Huang 2020-06-04 18:24:59 -04:00 committed by GitHub
parent 64847de3d6
commit b213d782b2
12 changed files with 424 additions and 16 deletions

View file

@ -19,6 +19,7 @@ import com.googlecode.objectify.annotation.Embed;
import google.registry.model.ImmutableObject; import google.registry.model.ImmutableObject;
import google.registry.model.eppcommon.Trid; import google.registry.model.eppcommon.Trid;
import google.registry.model.eppoutput.EppResponse.ResponseData; import google.registry.model.eppoutput.EppResponse.ResponseData;
import javax.persistence.Embeddable;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -29,11 +30,12 @@ import org.joda.time.DateTime;
/** The {@link ResponseData} returned when completing a pending action on a domain. */ /** The {@link ResponseData} returned when completing a pending action on a domain. */
@XmlTransient @XmlTransient
public abstract class PendingActionNotificationResponse @Embeddable
extends ImmutableObject implements ResponseData { public class PendingActionNotificationResponse extends ImmutableObject implements ResponseData {
/** The inner name type that contains a name and the result boolean. */ /** The inner name type that contains a name and the result boolean. */
@Embed @Embed
@Embeddable
static class NameOrId extends ImmutableObject { static class NameOrId extends ImmutableObject {
@XmlValue @XmlValue
String value; String value;

View file

@ -25,6 +25,7 @@ import com.googlecode.objectify.Key;
import com.googlecode.objectify.annotation.Entity; import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.EntitySubclass; import com.googlecode.objectify.annotation.EntitySubclass;
import com.googlecode.objectify.annotation.Id; import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Ignore;
import com.googlecode.objectify.annotation.Index; import com.googlecode.objectify.annotation.Index;
import com.googlecode.objectify.annotation.Parent; import com.googlecode.objectify.annotation.Parent;
import google.registry.model.Buildable; import google.registry.model.Buildable;
@ -39,10 +40,23 @@ import google.registry.model.poll.PendingActionNotificationResponse.DomainPendin
import google.registry.model.poll.PendingActionNotificationResponse.HostPendingActionNotificationResponse; import google.registry.model.poll.PendingActionNotificationResponse.HostPendingActionNotificationResponse;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import google.registry.model.transfer.TransferData.TransferServerApproveEntity; import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
import google.registry.model.transfer.TransferResponse;
import google.registry.model.transfer.TransferResponse.ContactTransferResponse; import google.registry.model.transfer.TransferResponse.ContactTransferResponse;
import google.registry.model.transfer.TransferResponse.DomainTransferResponse; import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
import google.registry.persistence.WithLongVKey;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Embedded;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Transient;
import org.joda.time.DateTime; import org.joda.time.DateTime;
/** /**
@ -68,28 +82,52 @@ import org.joda.time.DateTime;
@Entity @Entity
@ReportedOn @ReportedOn
@ExternalMessagingName("message") @ExternalMessagingName("message")
@javax.persistence.Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "type")
@javax.persistence.Table(
indexes = {
@javax.persistence.Index(columnList = "registrar_id"),
@javax.persistence.Index(columnList = "eventTime")
})
public abstract class PollMessage extends ImmutableObject public abstract class PollMessage extends ImmutableObject
implements Buildable, TransferServerApproveEntity { implements Buildable, TransferServerApproveEntity {
/** Entity id. */ /** Entity id. */
@Id @Id
long id; @javax.persistence.Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "poll_message_id")
Long id;
@Parent @Parent @DoNotHydrate @Transient Key<HistoryEntry> parent;
@DoNotHydrate
Key<HistoryEntry> parent;
/** The registrar that this poll message will be delivered to. */ /** The registrar that this poll message will be delivered to. */
@Index @Index
@Column(name = "registrar_id", nullable = false)
String clientId; String clientId;
/** The time when the poll message should be delivered. May be in the future. */ /** The time when the poll message should be delivered. May be in the future. */
@Index @Index
@Column(nullable = false)
DateTime eventTime; DateTime eventTime;
/** Human readable message that will be returned with this poll message. */ /** Human readable message that will be returned with this poll message. */
@Column(name = "message")
String msg; String msg;
@Ignore String domainRepoId;
@Ignore String contactRepoId;
@Ignore String hostRepoId;
@Ignore Long domainRevisionId;
@Ignore Long contactRevisionId;
@Ignore Long hostRevisionId;
public Key<HistoryEntry> getParentKey() { public Key<HistoryEntry> getParentKey() {
return parent; return parent;
} }
@ -180,15 +218,78 @@ public abstract class PollMessage extends ImmutableObject
* <p>One-time poll messages are deleted from Datastore once they have been delivered and ACKed. * <p>One-time poll messages are deleted from Datastore once they have been delivered and ACKed.
*/ */
@EntitySubclass(index = false) @EntitySubclass(index = false)
@javax.persistence.Entity
@DiscriminatorValue("ONE_TIME")
@WithLongVKey
public static class OneTime extends PollMessage { public static class OneTime extends PollMessage {
// Response data. Objectify cannot persist a base class type, so we must have a separate field // Response data. Objectify cannot persist a base class type, so we must have a separate field
// to hold every possible derived type of ResponseData that we might store. // to hold every possible derived type of ResponseData that we might store.
@Transient
List<ContactPendingActionNotificationResponse> contactPendingActionNotificationResponses; List<ContactPendingActionNotificationResponse> contactPendingActionNotificationResponses;
List<ContactTransferResponse> contactTransferResponses;
@Transient List<ContactTransferResponse> contactTransferResponses;
@Transient
List<DomainPendingActionNotificationResponse> domainPendingActionNotificationResponses; List<DomainPendingActionNotificationResponse> domainPendingActionNotificationResponses;
List<DomainTransferResponse> domainTransferResponses;
List<HostPendingActionNotificationResponse> hostPendingActionNotificationResponses; @Transient List<DomainTransferResponse> domainTransferResponses;
@Transient List<HostPendingActionNotificationResponse> hostPendingActionNotificationResponses;
@Ignore
@Embedded
@AttributeOverrides({
@AttributeOverride(
name = "nameOrId.value",
column = @Column(name = "pending_action_response_name_or_id")),
@AttributeOverride(
name = "nameOrId.actionResult",
column = @Column(name = "pending_action_response_action_result")),
@AttributeOverride(
name = "trid.serverTransactionId",
column = @Column(name = "pending_action_response_server_txn_id")),
@AttributeOverride(
name = "trid.clientTransactionId",
column = @Column(name = "pending_action_response_client_txn_id")),
@AttributeOverride(
name = "processedDate",
column = @Column(name = "pending_action_response_processed_date"))
})
PendingActionNotificationResponse pendingActionNotificationResponse;
@Ignore
@Embedded
@AttributeOverrides({
@AttributeOverride(
name = "transferStatus",
column = @Column(name = "transfer_response_transfer_status")),
@AttributeOverride(
name = "gainingClientId",
column = @Column(name = "transfer_response_gaining_registrar_id")),
@AttributeOverride(
name = "transferRequestTime",
column = @Column(name = "transfer_response_transfer_request_time")),
@AttributeOverride(
name = "losingClientId",
column = @Column(name = "transfer_response_losing_registrar_id")),
@AttributeOverride(
name = "pendingTransferExpirationTime",
column = @Column(name = "transfer_response_pending_transfer_expiration_time"))
})
TransferResponse transferResponse;
@Ignore
@Column(name = "transfer_response_domain_name")
String fullyQualifiedDomainName;
@Ignore
@Column(name = "transfer_response_domain_expiration_time")
DateTime extendedRegistrationExpirationTime;
@Ignore
@Column(name = "transfer_response_contact_id")
String contactId;
@Override @Override
public Builder asBuilder() { public Builder asBuilder() {
@ -265,9 +366,13 @@ public abstract class PollMessage extends ImmutableObject
* happens. * happens.
*/ */
@EntitySubclass(index = false) @EntitySubclass(index = false)
@javax.persistence.Entity
@DiscriminatorValue("AUTORENEW")
@WithLongVKey
public static class Autorenew extends PollMessage { public static class Autorenew extends PollMessage {
/** The target id of the autorenew event. */ /** The target id of the autorenew event. */
@Column(name = "autorenew_domain_name")
String targetId; String targetId;
/** The autorenew recurs annually between {@link #eventTime} and this time. */ /** The autorenew recurs annually between {@link #eventTime} and this time. */

View file

@ -16,6 +16,8 @@ package google.registry.model.transfer;
import google.registry.model.Buildable.GenericBuilder; import google.registry.model.Buildable.GenericBuilder;
import google.registry.model.ImmutableObject; import google.registry.model.ImmutableObject;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlTransient;
@ -31,6 +33,7 @@ public abstract class BaseTransferObject extends ImmutableObject {
* will always be non-null. * will always be non-null.
*/ */
@XmlElement(name = "trStatus") @XmlElement(name = "trStatus")
@Enumerated(EnumType.STRING)
TransferStatus transferStatus; TransferStatus transferStatus;
/** The gaining registrar of the current or last transfer. Can be null if never transferred. */ /** The gaining registrar of the current or last transfer. Can be null if never transferred. */

View file

@ -17,6 +17,7 @@ package google.registry.model.transfer;
import com.googlecode.objectify.annotation.Embed; import com.googlecode.objectify.annotation.Embed;
import google.registry.model.EppResource; import google.registry.model.EppResource;
import google.registry.model.eppoutput.EppResponse.ResponseData; import google.registry.model.eppoutput.EppResponse.ResponseData;
import javax.persistence.Embeddable;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlTransient;
@ -28,7 +29,8 @@ import org.joda.time.DateTime;
* are common to all transfer responses; derived classes add resource specific fields. * are common to all transfer responses; derived classes add resource specific fields.
*/ */
@XmlTransient @XmlTransient
public abstract class TransferResponse extends BaseTransferObject implements ResponseData { @Embeddable
public class TransferResponse extends BaseTransferObject implements ResponseData {
/** An adapter to output the XML in response to a transfer command on a domain. */ /** An adapter to output the XML in response to a transfer command on a domain. */
@Embed @Embed

View file

@ -36,6 +36,9 @@
<class>google.registry.schema.tld.ReservedList</class> <class>google.registry.schema.tld.ReservedList</class>
<class>google.registry.model.domain.secdns.DelegationSignerData</class> <class>google.registry.model.domain.secdns.DelegationSignerData</class>
<class>google.registry.model.domain.GracePeriod</class> <class>google.registry.model.domain.GracePeriod</class>
<class>google.registry.model.poll.PollMessage</class>
<class>google.registry.model.poll.PollMessage$OneTime</class>
<class>google.registry.model.poll.PollMessage$Autorenew</class>
<!-- Customized type converters --> <!-- Customized type converters -->
<class>google.registry.persistence.converter.BillingCostTransitionConverter</class> <class>google.registry.persistence.converter.BillingCostTransitionConverter</class>

View file

@ -16,24 +16,31 @@ package google.registry.model.poll;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistActiveDomain; import static google.registry.testing.DatastoreHelper.persistActiveDomain;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.SqlHelper.saveRegistrar;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import google.registry.model.EntityTestCase; import google.registry.model.EntityTestCase;
import google.registry.model.domain.Period; import google.registry.model.domain.Period;
import google.registry.model.eppcommon.Trid; import google.registry.model.eppcommon.Trid;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import org.junit.Before; import google.registry.persistence.VKey;
import org.junit.Test; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/** Unit tests for {@link PollMessage}. */ /** Unit tests for {@link PollMessage}. */
public class PollMessageTest extends EntityTestCase { public class PollMessageTest extends EntityTestCase {
HistoryEntry historyEntry; HistoryEntry historyEntry;
@Before public PollMessageTest() {
super(true);
}
@BeforeEach
public void setUp() { public void setUp() {
createTld("foobar"); createTld("foobar");
historyEntry = historyEntry =
@ -52,6 +59,50 @@ public class PollMessageTest extends EntityTestCase {
.build()); .build());
} }
@Test
void testCloudSqlPersistenceOneTime() {
saveRegistrar("TheRegistrar");
PollMessage.OneTime pollMessage =
new PollMessage.OneTime.Builder()
.setClientId("TheRegistrar")
.setEventTime(fakeClock.nowUtc())
.setMsg("Test poll message")
.setParent(historyEntry)
.build();
pollMessage.id = null;
jpaTm().transact(() -> jpaTm().saveNew(pollMessage));
PollMessage.OneTime persisted =
jpaTm()
.transact(
() -> jpaTm().load(VKey.createSql(PollMessage.OneTime.class, pollMessage.id)));
persisted.id = pollMessage.id;
persisted.parent = pollMessage.parent;
assertThat(persisted).isEqualTo(pollMessage);
}
@Test
void testCloudSqlPersistenceAutorenew() {
saveRegistrar("TheRegistrar");
PollMessage.Autorenew pollMessage =
new PollMessage.Autorenew.Builder()
.setClientId("TheRegistrar")
.setEventTime(fakeClock.nowUtc())
.setMsg("Test poll message")
.setParent(historyEntry)
.setAutorenewEndTime(fakeClock.nowUtc().plusDays(365))
.setTargetId("foobar.foo")
.build();
pollMessage.id = null;
jpaTm().transact(() -> jpaTm().saveNew(pollMessage));
PollMessage.Autorenew persisted =
jpaTm()
.transact(
() -> jpaTm().load(VKey.createSql(PollMessage.Autorenew.class, pollMessage.id)));
persisted.id = pollMessage.id;
persisted.parent = pollMessage.parent;
assertThat(persisted).isEqualTo(pollMessage);
}
@Test @Test
public void testPersistenceOneTime() { public void testPersistenceOneTime() {
PollMessage.OneTime pollMessage = PollMessage.OneTime pollMessage =

View file

@ -28,6 +28,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.Supplier; import java.util.function.Supplier;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity; import javax.persistence.Entity;
import org.junit.rules.ExternalResource; import org.junit.rules.ExternalResource;
@ -46,6 +47,7 @@ public class JpaEntityCoverage extends ExternalResource {
PersistenceXmlUtility.getManagedClasses().stream() PersistenceXmlUtility.getManagedClasses().stream()
.filter(e -> !IGNORE_ENTITIES.contains(e.getSimpleName())) .filter(e -> !IGNORE_ENTITIES.contains(e.getSimpleName()))
.filter(e -> e.isAnnotationPresent(Entity.class)) .filter(e -> e.isAnnotationPresent(Entity.class))
.filter(e -> !e.isAnnotationPresent(DiscriminatorValue.class))
.collect(ImmutableSet.toImmutableSet()); .collect(ImmutableSet.toImmutableSet());
private static final Set<Class> allCoveredJpaEntities = Sets.newHashSet(); private static final Set<Class> allCoveredJpaEntities = Sets.newHashSet();
// Map of test class name to boolean flag indicating if it tests any JPA entities. // Map of test class name to boolean flag indicating if it tests any JPA entities.

View file

@ -19,6 +19,7 @@ import static com.google.common.truth.Truth.assert_;
import google.registry.model.billing.BillingEventTest; import google.registry.model.billing.BillingEventTest;
import google.registry.model.contact.ContactResourceTest; import google.registry.model.contact.ContactResourceTest;
import google.registry.model.domain.DomainBaseSqlTest; import google.registry.model.domain.DomainBaseSqlTest;
import google.registry.model.poll.PollMessageTest;
import google.registry.model.registry.RegistryLockDaoTest; import google.registry.model.registry.RegistryLockDaoTest;
import google.registry.persistence.transaction.JpaEntityCoverage; import google.registry.persistence.transaction.JpaEntityCoverage;
import google.registry.schema.cursor.CursorDaoTest; import google.registry.schema.cursor.CursorDaoTest;
@ -75,6 +76,7 @@ import org.junit.runner.RunWith;
CursorDaoTest.class, CursorDaoTest.class,
DomainBaseSqlTest.class, DomainBaseSqlTest.class,
LockDaoTest.class, LockDaoTest.class,
PollMessageTest.class,
PremiumListDaoTest.class, PremiumListDaoTest.class,
RegistrarDaoTest.class, RegistrarDaoTest.class,
RegistryLockDaoTest.class, RegistryLockDaoTest.class,

View file

@ -373,14 +373,14 @@ class google.registry.model.poll.PendingActionNotificationResponse$NameOrId {
java.lang.String value; java.lang.String value;
} }
class google.registry.model.poll.PollMessage { class google.registry.model.poll.PollMessage {
@Id long id; @Id java.lang.Long id;
@Parent com.googlecode.objectify.Key<google.registry.model.reporting.HistoryEntry> parent; @Parent com.googlecode.objectify.Key<google.registry.model.reporting.HistoryEntry> parent;
java.lang.String clientId; java.lang.String clientId;
java.lang.String msg; java.lang.String msg;
org.joda.time.DateTime eventTime; org.joda.time.DateTime eventTime;
} }
class google.registry.model.poll.PollMessage$Autorenew { class google.registry.model.poll.PollMessage$Autorenew {
@Id long id; @Id java.lang.Long id;
@Parent com.googlecode.objectify.Key<google.registry.model.reporting.HistoryEntry> parent; @Parent com.googlecode.objectify.Key<google.registry.model.reporting.HistoryEntry> parent;
java.lang.String clientId; java.lang.String clientId;
java.lang.String msg; java.lang.String msg;
@ -389,7 +389,7 @@ class google.registry.model.poll.PollMessage$Autorenew {
org.joda.time.DateTime eventTime; org.joda.time.DateTime eventTime;
} }
class google.registry.model.poll.PollMessage$OneTime { class google.registry.model.poll.PollMessage$OneTime {
@Id long id; @Id java.lang.Long id;
@Parent com.googlecode.objectify.Key<google.registry.model.reporting.HistoryEntry> parent; @Parent com.googlecode.objectify.Key<google.registry.model.reporting.HistoryEntry> parent;
java.lang.String clientId; java.lang.String clientId;
java.lang.String msg; java.lang.String msg;

View file

@ -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.
create table "PollMessage" (
type text not null,
poll_message_id bigserial not null,
registrar_id text not null,
contact_repo_id text,
contact_revision_id int8,
domain_repo_id text,
domain_revision_id int8,
event_time timestamptz not null,
host_repo_id text,
host_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 boolean,
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,
primary key (poll_message_id)
);
create index IDXe7wu46c7wpvfmfnj4565abibp on "PollMessage" (registrar_id);
create index IDXaydgox62uno9qx8cjlj5lauye on "PollMessage" (event_time);
alter table if exists "PollMessage"
add constraint fk_poll_message_registrar_id
foreign key (registrar_id)
references "Registrar";
alter table if exists "PollMessage"
add constraint fk_poll_message_contact_repo_id
foreign key (contact_repo_id)
references "Contact";
alter table if exists "PollMessage"
add constraint fk_poll_message_domain_repo_id
foreign key (domain_repo_id)
references "Domain";
alter table if exists "PollMessage"
add constraint fk_poll_message_host_repo_id
foreign key (host_repo_id)
references "HostResource";
alter table if exists "PollMessage"
add constraint fk_poll_message_transfer_response_gaining_registrar_id
foreign key (transfer_response_gaining_registrar_id)
references "Registrar";
alter table if exists "PollMessage"
add constraint fk_poll_message_transfer_response_losing_registrar_id
foreign key (transfer_response_losing_registrar_id)
references "Registrar";

View file

@ -213,6 +213,36 @@
primary key (resource_name, tld) primary key (resource_name, tld)
); );
create table "PollMessage" (
type text not null,
poll_message_id bigserial not null,
registrar_id text not null,
contact_repo_id text,
contact_revision_id int8,
domain_repo_id text,
domain_revision_id int8,
event_time timestamptz not null,
host_repo_id text,
host_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 boolean,
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,
primary key (poll_message_id)
);
create table "PremiumEntry" ( create table "PremiumEntry" (
revision_id int8 not null, revision_id int8 not null,
domain_label text not null, domain_label text not null,
@ -352,6 +382,8 @@ create index IDX8ffrqm27qtj20jac056j7yq07 on "Domain" (current_sponsor_client_id
create index IDX5mnf0wn20tno4b9do88j61klr on "Domain" (deletion_time); create index IDX5mnf0wn20tno4b9do88j61klr on "Domain" (deletion_time);
create index IDX1rcgkdd777bpvj0r94sltwd5y on "Domain" (fully_qualified_domain_name); create index IDX1rcgkdd777bpvj0r94sltwd5y on "Domain" (fully_qualified_domain_name);
create index IDXrwl38wwkli1j7gkvtywi9jokq on "Domain" (tld); create index IDXrwl38wwkli1j7gkvtywi9jokq on "Domain" (tld);
create index IDXe7wu46c7wpvfmfnj4565abibp on "PollMessage" (registrar_id);
create index IDXaydgox62uno9qx8cjlj5lauye on "PollMessage" (event_time);
create index premiumlist_name_idx on "PremiumList" (name); create index premiumlist_name_idx on "PremiumList" (name);
create index registrar_name_idx on "Registrar" (registrar_name); create index registrar_name_idx on "Registrar" (registrar_name);
create index registrar_iana_identifier_idx on "Registrar" (iana_identifier); create index registrar_iana_identifier_idx on "Registrar" (iana_identifier);

View file

@ -343,6 +343,59 @@ CREATE TABLE public."Lock" (
); );
--
-- Name: PollMessage; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public."PollMessage" (
type text NOT NULL,
poll_message_id bigint NOT NULL,
registrar_id text NOT NULL,
contact_repo_id text,
contact_revision_id bigint,
domain_repo_id text,
domain_revision_id bigint,
event_time timestamp with time zone NOT NULL,
host_repo_id text,
host_revision_id bigint,
message text,
transfer_response_contact_id text,
transfer_response_domain_expiration_time timestamp with time zone,
transfer_response_domain_name text,
pending_action_response_action_result boolean,
pending_action_response_name_or_id text,
pending_action_response_processed_date timestamp with time zone,
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 timestamp with time zone,
transfer_response_transfer_request_time timestamp with time zone,
transfer_response_transfer_status text,
autorenew_end_time timestamp with time zone,
autorenew_domain_name text
);
--
-- Name: PollMessage_poll_message_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public."PollMessage_poll_message_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: PollMessage_poll_message_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public."PollMessage_poll_message_id_seq" OWNED BY public."PollMessage".poll_message_id;
-- --
-- Name: PremiumEntry; Type: TABLE; Schema: public; Owner: - -- Name: PremiumEntry; Type: TABLE; Schema: public; Owner: -
-- --
@ -572,6 +625,13 @@ ALTER TABLE ONLY public."BillingRecurrence" ALTER COLUMN billing_recurrence_id S
ALTER TABLE ONLY public."ClaimsList" ALTER COLUMN revision_id SET DEFAULT nextval('public."ClaimsList_revision_id_seq"'::regclass); ALTER TABLE ONLY public."ClaimsList" ALTER COLUMN revision_id SET DEFAULT nextval('public."ClaimsList_revision_id_seq"'::regclass);
--
-- Name: PollMessage poll_message_id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage" ALTER COLUMN poll_message_id SET DEFAULT nextval('public."PollMessage_poll_message_id_seq"'::regclass);
-- --
-- Name: PremiumList revision_id; Type: DEFAULT; Schema: public; Owner: - -- Name: PremiumList revision_id; Type: DEFAULT; Schema: public; Owner: -
-- --
@ -673,6 +733,14 @@ ALTER TABLE ONLY public."Lock"
ADD CONSTRAINT "Lock_pkey" PRIMARY KEY (resource_name, tld); ADD CONSTRAINT "Lock_pkey" PRIMARY KEY (resource_name, tld);
--
-- Name: PollMessage PollMessage_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT "PollMessage_pkey" PRIMARY KEY (poll_message_id);
-- --
-- Name: PremiumEntry PremiumEntry_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- Name: PremiumEntry PremiumEntry_pkey; Type: CONSTRAINT; Schema: public; Owner: -
-- --
@ -829,6 +897,13 @@ CREATE INDEX idx_registry_lock_registrar_id ON public."RegistryLock" USING btree
CREATE INDEX idx_registry_lock_verification_code ON public."RegistryLock" USING btree (verification_code); CREATE INDEX idx_registry_lock_verification_code ON public."RegistryLock" USING btree (verification_code);
--
-- Name: idxaydgox62uno9qx8cjlj5lauye; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idxaydgox62uno9qx8cjlj5lauye ON public."PollMessage" USING btree (event_time);
-- --
-- Name: idxbn8t4wp85fgxjl8q4ctlscx55; Type: INDEX; Schema: public; Owner: - -- Name: idxbn8t4wp85fgxjl8q4ctlscx55; Type: INDEX; Schema: public; Owner: -
-- --
@ -836,6 +911,13 @@ CREATE INDEX idx_registry_lock_verification_code ON public."RegistryLock" USING
CREATE INDEX idxbn8t4wp85fgxjl8q4ctlscx55 ON public."Contact" USING btree (current_sponsor_client_id); CREATE INDEX idxbn8t4wp85fgxjl8q4ctlscx55 ON public."Contact" USING btree (current_sponsor_client_id);
--
-- Name: idxe7wu46c7wpvfmfnj4565abibp; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idxe7wu46c7wpvfmfnj4565abibp ON public."PollMessage" USING btree (registrar_id);
-- --
-- Name: idxeokttmxtpq2hohcioe5t2242b; Type: INDEX; Schema: public; Owner: - -- Name: idxeokttmxtpq2hohcioe5t2242b; Type: INDEX; Schema: public; Owner: -
-- --
@ -1085,6 +1167,54 @@ ALTER TABLE ONLY public."DomainHost"
ADD CONSTRAINT fk_domainhost_host_valid FOREIGN KEY (ns_hosts) REFERENCES public."HostResource"(repo_id); ADD CONSTRAINT fk_domainhost_host_valid FOREIGN KEY (ns_hosts) REFERENCES public."HostResource"(repo_id);
--
-- Name: PollMessage fk_poll_message_contact_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_contact_repo_id FOREIGN KEY (contact_repo_id) REFERENCES public."Contact"(repo_id);
--
-- Name: PollMessage fk_poll_message_domain_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_domain_repo_id FOREIGN KEY (domain_repo_id) REFERENCES public."Domain"(repo_id);
--
-- Name: PollMessage fk_poll_message_host_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_host_repo_id FOREIGN KEY (host_repo_id) REFERENCES public."HostResource"(repo_id);
--
-- Name: PollMessage fk_poll_message_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_registrar_id FOREIGN KEY (registrar_id) REFERENCES public."Registrar"(client_id);
--
-- Name: PollMessage fk_poll_message_transfer_response_gaining_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_transfer_response_gaining_registrar_id FOREIGN KEY (transfer_response_gaining_registrar_id) REFERENCES public."Registrar"(client_id);
--
-- Name: PollMessage fk_poll_message_transfer_response_losing_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_transfer_response_losing_registrar_id FOREIGN KEY (transfer_response_losing_registrar_id) REFERENCES public."Registrar"(client_id);
-- --
-- Name: DomainHost fkfmi7bdink53swivs390m2btxg; Type: FK CONSTRAINT; Schema: public; Owner: - -- Name: DomainHost fkfmi7bdink53swivs390m2btxg; Type: FK CONSTRAINT; Schema: public; Owner: -
-- --