diff --git a/core/src/main/java/google/registry/model/poll/PendingActionNotificationResponse.java b/core/src/main/java/google/registry/model/poll/PendingActionNotificationResponse.java index 76c7450ee..1e96de44d 100644 --- a/core/src/main/java/google/registry/model/poll/PendingActionNotificationResponse.java +++ b/core/src/main/java/google/registry/model/poll/PendingActionNotificationResponse.java @@ -19,6 +19,7 @@ import com.googlecode.objectify.annotation.Embed; import google.registry.model.ImmutableObject; import google.registry.model.eppcommon.Trid; import google.registry.model.eppoutput.EppResponse.ResponseData; +import javax.persistence.Embeddable; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; 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. */ @XmlTransient -public abstract class PendingActionNotificationResponse - extends ImmutableObject implements ResponseData { +@Embeddable +public class PendingActionNotificationResponse extends ImmutableObject implements ResponseData { /** The inner name type that contains a name and the result boolean. */ @Embed + @Embeddable static class NameOrId extends ImmutableObject { @XmlValue String value; diff --git a/core/src/main/java/google/registry/model/poll/PollMessage.java b/core/src/main/java/google/registry/model/poll/PollMessage.java index c48934005..3976941cd 100644 --- a/core/src/main/java/google/registry/model/poll/PollMessage.java +++ b/core/src/main/java/google/registry/model/poll/PollMessage.java @@ -25,6 +25,7 @@ import com.googlecode.objectify.Key; import com.googlecode.objectify.annotation.Entity; import com.googlecode.objectify.annotation.EntitySubclass; import com.googlecode.objectify.annotation.Id; +import com.googlecode.objectify.annotation.Ignore; import com.googlecode.objectify.annotation.Index; import com.googlecode.objectify.annotation.Parent; 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.reporting.HistoryEntry; 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.DomainTransferResponse; +import google.registry.persistence.WithLongVKey; import java.util.List; 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; /** @@ -68,28 +82,52 @@ import org.joda.time.DateTime; @Entity @ReportedOn @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 implements Buildable, TransferServerApproveEntity { /** Entity id. */ @Id - long id; + @javax.persistence.Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "poll_message_id") + Long id; - @Parent - @DoNotHydrate - Key parent; + @Parent @DoNotHydrate @Transient Key parent; /** The registrar that this poll message will be delivered to. */ @Index + @Column(name = "registrar_id", nullable = false) String clientId; /** The time when the poll message should be delivered. May be in the future. */ @Index + @Column(nullable = false) DateTime eventTime; /** Human readable message that will be returned with this poll message. */ + @Column(name = "message") String msg; + @Ignore String domainRepoId; + + @Ignore String contactRepoId; + + @Ignore String hostRepoId; + + @Ignore Long domainRevisionId; + + @Ignore Long contactRevisionId; + + @Ignore Long hostRevisionId; + public Key getParentKey() { return parent; } @@ -180,15 +218,78 @@ public abstract class PollMessage extends ImmutableObject *

One-time poll messages are deleted from Datastore once they have been delivered and ACKed. */ @EntitySubclass(index = false) + @javax.persistence.Entity + @DiscriminatorValue("ONE_TIME") + @WithLongVKey public static class OneTime extends PollMessage { // 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. + @Transient List contactPendingActionNotificationResponses; - List contactTransferResponses; + + @Transient List contactTransferResponses; + + @Transient List domainPendingActionNotificationResponses; - List domainTransferResponses; - List hostPendingActionNotificationResponses; + + @Transient List domainTransferResponses; + + @Transient List 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 public Builder asBuilder() { @@ -265,9 +366,13 @@ public abstract class PollMessage extends ImmutableObject * happens. */ @EntitySubclass(index = false) + @javax.persistence.Entity + @DiscriminatorValue("AUTORENEW") + @WithLongVKey public static class Autorenew extends PollMessage { /** The target id of the autorenew event. */ + @Column(name = "autorenew_domain_name") String targetId; /** The autorenew recurs annually between {@link #eventTime} and this time. */ diff --git a/core/src/main/java/google/registry/model/transfer/BaseTransferObject.java b/core/src/main/java/google/registry/model/transfer/BaseTransferObject.java index 50528758a..09807b336 100644 --- a/core/src/main/java/google/registry/model/transfer/BaseTransferObject.java +++ b/core/src/main/java/google/registry/model/transfer/BaseTransferObject.java @@ -16,6 +16,8 @@ package google.registry.model.transfer; import google.registry.model.Buildable.GenericBuilder; import google.registry.model.ImmutableObject; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; import javax.persistence.MappedSuperclass; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlTransient; @@ -31,6 +33,7 @@ public abstract class BaseTransferObject extends ImmutableObject { * will always be non-null. */ @XmlElement(name = "trStatus") + @Enumerated(EnumType.STRING) TransferStatus transferStatus; /** The gaining registrar of the current or last transfer. Can be null if never transferred. */ diff --git a/core/src/main/java/google/registry/model/transfer/TransferResponse.java b/core/src/main/java/google/registry/model/transfer/TransferResponse.java index 9deea4cb3..8407d60a1 100644 --- a/core/src/main/java/google/registry/model/transfer/TransferResponse.java +++ b/core/src/main/java/google/registry/model/transfer/TransferResponse.java @@ -17,6 +17,7 @@ package google.registry.model.transfer; import com.googlecode.objectify.annotation.Embed; import google.registry.model.EppResource; import google.registry.model.eppoutput.EppResponse.ResponseData; +import javax.persistence.Embeddable; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; 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. */ @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. */ @Embed diff --git a/core/src/main/resources/META-INF/persistence.xml b/core/src/main/resources/META-INF/persistence.xml index 0535b1416..a3979428a 100644 --- a/core/src/main/resources/META-INF/persistence.xml +++ b/core/src/main/resources/META-INF/persistence.xml @@ -36,6 +36,9 @@ google.registry.schema.tld.ReservedList google.registry.model.domain.secdns.DelegationSignerData google.registry.model.domain.GracePeriod + google.registry.model.poll.PollMessage + google.registry.model.poll.PollMessage$OneTime + google.registry.model.poll.PollMessage$Autorenew google.registry.persistence.converter.BillingCostTransitionConverter diff --git a/core/src/test/java/google/registry/model/poll/PollMessageTest.java b/core/src/test/java/google/registry/model/poll/PollMessageTest.java index 56df67621..6bb4570da 100644 --- a/core/src/test/java/google/registry/model/poll/PollMessageTest.java +++ b/core/src/test/java/google/registry/model/poll/PollMessageTest.java @@ -16,24 +16,31 @@ package google.registry.model.poll; import static com.google.common.truth.Truth.assertThat; 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.persistActiveDomain; import static google.registry.testing.DatastoreHelper.persistResource; +import static google.registry.testing.SqlHelper.saveRegistrar; import static java.nio.charset.StandardCharsets.UTF_8; import google.registry.model.EntityTestCase; import google.registry.model.domain.Period; import google.registry.model.eppcommon.Trid; import google.registry.model.reporting.HistoryEntry; -import org.junit.Before; -import org.junit.Test; +import google.registry.persistence.VKey; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** Unit tests for {@link PollMessage}. */ public class PollMessageTest extends EntityTestCase { HistoryEntry historyEntry; - @Before + public PollMessageTest() { + super(true); + } + + @BeforeEach public void setUp() { createTld("foobar"); historyEntry = @@ -52,6 +59,50 @@ public class PollMessageTest extends EntityTestCase { .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 public void testPersistenceOneTime() { PollMessage.OneTime pollMessage = diff --git a/core/src/test/java/google/registry/persistence/transaction/JpaEntityCoverage.java b/core/src/test/java/google/registry/persistence/transaction/JpaEntityCoverage.java index 7ec954c86..3d403c4e2 100644 --- a/core/src/test/java/google/registry/persistence/transaction/JpaEntityCoverage.java +++ b/core/src/test/java/google/registry/persistence/transaction/JpaEntityCoverage.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.function.Supplier; +import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import org.junit.rules.ExternalResource; @@ -46,6 +47,7 @@ public class JpaEntityCoverage extends ExternalResource { PersistenceXmlUtility.getManagedClasses().stream() .filter(e -> !IGNORE_ENTITIES.contains(e.getSimpleName())) .filter(e -> e.isAnnotationPresent(Entity.class)) + .filter(e -> !e.isAnnotationPresent(DiscriminatorValue.class)) .collect(ImmutableSet.toImmutableSet()); private static final Set allCoveredJpaEntities = Sets.newHashSet(); // Map of test class name to boolean flag indicating if it tests any JPA entities. 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 f2f66ed76..13ed2849c 100644 --- a/core/src/test/java/google/registry/schema/integration/SqlIntegrationTestSuite.java +++ b/core/src/test/java/google/registry/schema/integration/SqlIntegrationTestSuite.java @@ -19,6 +19,7 @@ import static com.google.common.truth.Truth.assert_; import google.registry.model.billing.BillingEventTest; import google.registry.model.contact.ContactResourceTest; import google.registry.model.domain.DomainBaseSqlTest; +import google.registry.model.poll.PollMessageTest; import google.registry.model.registry.RegistryLockDaoTest; import google.registry.persistence.transaction.JpaEntityCoverage; import google.registry.schema.cursor.CursorDaoTest; @@ -75,6 +76,7 @@ import org.junit.runner.RunWith; CursorDaoTest.class, DomainBaseSqlTest.class, LockDaoTest.class, + PollMessageTest.class, PremiumListDaoTest.class, RegistrarDaoTest.class, RegistryLockDaoTest.class, diff --git a/core/src/test/resources/google/registry/model/schema.txt b/core/src/test/resources/google/registry/model/schema.txt index ff833117a..ae5d03b80 100644 --- a/core/src/test/resources/google/registry/model/schema.txt +++ b/core/src/test/resources/google/registry/model/schema.txt @@ -373,14 +373,14 @@ class google.registry.model.poll.PendingActionNotificationResponse$NameOrId { java.lang.String value; } class google.registry.model.poll.PollMessage { - @Id long id; + @Id java.lang.Long id; @Parent com.googlecode.objectify.Key parent; java.lang.String clientId; java.lang.String msg; org.joda.time.DateTime eventTime; } class google.registry.model.poll.PollMessage$Autorenew { - @Id long id; + @Id java.lang.Long id; @Parent com.googlecode.objectify.Key parent; java.lang.String clientId; java.lang.String msg; @@ -389,7 +389,7 @@ class google.registry.model.poll.PollMessage$Autorenew { org.joda.time.DateTime eventTime; } class google.registry.model.poll.PollMessage$OneTime { - @Id long id; + @Id java.lang.Long id; @Parent com.googlecode.objectify.Key parent; java.lang.String clientId; java.lang.String msg; diff --git a/db/src/main/resources/sql/flyway/V27__create_pollmessage.sql b/db/src/main/resources/sql/flyway/V27__create_pollmessage.sql new file mode 100644 index 000000000..0cec5f1ec --- /dev/null +++ b/db/src/main/resources/sql/flyway/V27__create_pollmessage.sql @@ -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"; 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 dccafedd2..efd5db2c6 100644 --- a/db/src/main/resources/sql/schema/db-schema.sql.generated +++ b/db/src/main/resources/sql/schema/db-schema.sql.generated @@ -213,6 +213,36 @@ 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" ( revision_id int8 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 IDX1rcgkdd777bpvj0r94sltwd5y on "Domain" (fully_qualified_domain_name); 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 registrar_name_idx on "Registrar" (registrar_name); create index registrar_iana_identifier_idx on "Registrar" (iana_identifier); diff --git a/db/src/main/resources/sql/schema/nomulus.golden.sql b/db/src/main/resources/sql/schema/nomulus.golden.sql index 4ebe5e776..a120fc9d3 100644 --- a/db/src/main/resources/sql/schema/nomulus.golden.sql +++ b/db/src/main/resources/sql/schema/nomulus.golden.sql @@ -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: - -- @@ -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); +-- +-- 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: - -- @@ -673,6 +733,14 @@ ALTER TABLE ONLY public."Lock" 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: - -- @@ -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); +-- +-- Name: idxaydgox62uno9qx8cjlj5lauye; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idxaydgox62uno9qx8cjlj5lauye ON public."PollMessage" USING btree (event_time); + + -- -- 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); +-- +-- Name: idxe7wu46c7wpvfmfnj4565abibp; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX idxe7wu46c7wpvfmfnj4565abibp ON public."PollMessage" USING btree (registrar_id); + + -- -- 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); +-- +-- 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: - --