diff --git a/core/src/main/java/google/registry/model/billing/BillingEvent.java b/core/src/main/java/google/registry/model/billing/BillingEvent.java index 1fe08e7a2..0ad0fd030 100644 --- a/core/src/main/java/google/registry/model/billing/BillingEvent.java +++ b/core/src/main/java/google/registry/model/billing/BillingEvent.java @@ -308,7 +308,8 @@ public abstract class BillingEvent extends ImmutableObject @javax.persistence.Index(columnList = "eventTime"), @javax.persistence.Index(columnList = "billingTime"), @javax.persistence.Index(columnList = "syntheticCreationTime"), - @javax.persistence.Index(columnList = "allocationToken") + @javax.persistence.Index(columnList = "allocationToken"), + @javax.persistence.Index(columnList = "cancellation_matching_billing_recurrence_id") }) @AttributeOverride(name = "id", column = @Column(name = "billing_event_id")) @WithLongVKey(compositeKey = true) @@ -614,7 +615,9 @@ public abstract class BillingEvent extends ImmutableObject indexes = { @javax.persistence.Index(columnList = "registrarId"), @javax.persistence.Index(columnList = "eventTime"), - @javax.persistence.Index(columnList = "billingTime") + @javax.persistence.Index(columnList = "billingTime"), + @javax.persistence.Index(columnList = "billing_event_id"), + @javax.persistence.Index(columnList = "billing_recurrence_id") }) @AttributeOverride(name = "id", column = @Column(name = "billing_cancellation_id")) @WithLongVKey(compositeKey = true) diff --git a/core/src/main/java/google/registry/model/domain/DomainBase.java b/core/src/main/java/google/registry/model/domain/DomainBase.java index 9b367e26b..79cb89b80 100644 --- a/core/src/main/java/google/registry/model/domain/DomainBase.java +++ b/core/src/main/java/google/registry/model/domain/DomainBase.java @@ -69,7 +69,10 @@ import org.joda.time.DateTime; @Index(columnList = "techContact"), @Index(columnList = "tld"), @Index(columnList = "registrantContact"), - @Index(columnList = "dnsRefreshRequestTime") + @Index(columnList = "dnsRefreshRequestTime"), + @Index(columnList = "billing_recurrence_id"), + @Index(columnList = "transfer_billing_event_id"), + @Index(columnList = "transfer_billing_recurrence_id") }) @WithStringVKey @ExternalMessagingName("domain") @@ -89,7 +92,10 @@ public class DomainBase extends DomainContent @ElementCollection @JoinTable( name = "DomainHost", - indexes = {@Index(columnList = "domain_repo_id,host_repo_id", unique = true)}) + indexes = { + @Index(columnList = "domain_repo_id,host_repo_id", unique = true), + @Index(columnList = "host_repo_id") + }) @Access(AccessType.PROPERTY) @Column(name = "host_repo_id") public Set> getNsHosts() { diff --git a/core/src/main/java/google/registry/model/domain/GracePeriod.java b/core/src/main/java/google/registry/model/domain/GracePeriod.java index fbbbe63c3..4f15544bf 100644 --- a/core/src/main/java/google/registry/model/domain/GracePeriod.java +++ b/core/src/main/java/google/registry/model/domain/GracePeriod.java @@ -46,7 +46,12 @@ import org.joda.time.DateTime; */ @Embed @Entity -@Table(indexes = @Index(columnList = "domainRepoId")) +@Table( + indexes = { + @Index(columnList = "domainRepoId"), + @Index(columnList = "billing_event_id"), + @Index(columnList = "billing_recurrence_id") + }) public class GracePeriod extends GracePeriodBase implements DatastoreAndSqlEntity { @Id diff --git a/core/src/main/java/google/registry/model/transfer/DomainTransferData.java b/core/src/main/java/google/registry/model/transfer/DomainTransferData.java index 8c003e00f..6c6161267 100644 --- a/core/src/main/java/google/registry/model/transfer/DomainTransferData.java +++ b/core/src/main/java/google/registry/model/transfer/DomainTransferData.java @@ -94,8 +94,6 @@ public class DomainTransferData extends TransferData * *

This field should be null if there is not currently a pending transfer or if the object * being transferred is not a domain. - * - *

TODO(b/158230654) Remove unused columns for TransferData in Contact table. */ @IgnoreSave(IfNull.class) @Column(name = "transfer_billing_event_id") 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 6e0b1159a..c326612b6 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,7 +261,7 @@ td.section { generated on - 2022-03-09 22:28:58.465478 + 2022-03-14 17:59:45.688046 last flyway file @@ -284,7 +284,7 @@ td.section { generated on - 2022-03-09 22:28:58.465478 + 2022-03-14 17:59:45.688046 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 a80e2c145..f5ef6ae78 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,7 +261,7 @@ td.section { generated on - 2022-03-09 22:28:56.561494 + 2022-03-14 17:59:44.31197 last flyway file @@ -274,19 +274,19 @@ td.section { SchemaCrawler_Diagram - + generated by - + SchemaCrawler 16.10.1 - + generated on - - 2022-03-09 22:28:56.561494 + + 2022-03-14 17:59:44.31197 - + allocationtoken_a08ccbef 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 069c52aa8..b0e0ce9a4 100644 --- a/db/src/main/resources/sql/schema/db-schema.sql.generated +++ b/db/src/main/resources/sql/schema/db-schema.sql.generated @@ -762,11 +762,14 @@ create index allocation_token_domain_name_idx on "AllocationToken" (domain_name) create index IDXih4b2tea127p5rb61gje6e1y2 on "BillingCancellation" (registrar_id); create index IDX2exdfbx6oiiwnhr8j6gjpqt2j on "BillingCancellation" (event_time); create index IDXqa3g92jc17e8dtiaviy4fet4x on "BillingCancellation" (billing_time); +create index IDX4ytbe5f3b39trsd4okx5ijhs4 on "BillingCancellation" (billing_event_id); +create index IDXku0fopwyvd57ebo8bf0jg9xo2 on "BillingCancellation" (billing_recurrence_id); create index IDXqspv57gj2led8ly42fq01t7m7 on "BillingEvent" (registrar_id); create index IDX5yfbr88439pxw0v3j86c74fp8 on "BillingEvent" (event_time); create index IDX6py6ocrab0ivr76srcd2okpnq on "BillingEvent" (billing_time); create index IDXplxf9v56p0wg8ws6qsvd082hk on "BillingEvent" (synthetic_creation_time); create index IDXcesda59ssop44kklytpb292hn on "BillingEvent" (allocation_token); +create index IDX6ebt3nwk5ocvnremnhnlkl6ff on "BillingEvent" (cancellation_matching_billing_recurrence_id); create index IDXd3gxhkh0jk694pjvh9pyn7wjc on "BillingRecurrence" (registrar_id); create index IDX6syykou4nkc7hqa5p8r92cpch on "BillingRecurrence" (event_time); create index IDXp3usbtvk0v1m14i5tdp4xnxgc on "BillingRecurrence" (recurrence_end_time); @@ -792,6 +795,9 @@ create index IDXr22ciyccwi9rrqmt1ro0s59qf on "Domain" (tech_contact); create index IDXrwl38wwkli1j7gkvtywi9jokq on "Domain" (tld); create index IDXa7fu0bqynfb79rr80528b4jqt on "Domain" (registrant_contact); create index IDXcws5mvmpl8o10wrhde780ors2 on "Domain" (dns_refresh_request_time); +create index IDXsfci08jgsymxy6ovh4k7r358c on "Domain" (billing_recurrence_id); +create index IDX3y3k7m2bkgahm9sixiohgyrga on "Domain" (transfer_billing_event_id); +create index IDXcju58vqascbpve1t7fem53ctl on "Domain" (transfer_billing_recurrence_id); create index IDXrh4xmrot9bd63o382ow9ltfig on "DomainHistory" (creation_time); create index IDXaro1omfuaxjwmotk3vo00trwm on "DomainHistory" (history_registrar_id); create index IDXsu1nam10cjes9keobapn5jvxj on "DomainHistory" (history_type); @@ -799,10 +805,13 @@ create index IDX6w3qbtgce93cal2orjg1tw7b7 on "DomainHistory" (history_modificati alter table if exists "DomainHistoryHost" add constraint UKt2e7ae3t8gcsxd13wjx2ka7ij unique (domain_history_history_revision_id, domain_history_domain_repo_id, host_repo_id); +create index IDXjw3rwtfrexyq53x9vu7qghrdt on "DomainHost" (host_repo_id); alter table if exists "DomainHost" add constraint UKat9erbh52e4lg3jw6ai9wkjj9 unique (domain_repo_id, host_repo_id); create index IDXj1mtx98ndgbtb1bkekahms18w on "GracePeriod" (domain_repo_id); +create index IDXbgssjudpm428mrv0xfpvgifps on "GracePeriod" (billing_event_id); +create index IDX5u5m6clpk3nktrvtyy5umacb6 on "GracePeriod" (billing_recurrence_id); create index IDXd01j17vrpjxaerxdmn8bwxs7s on "GracePeriodHistory" (domain_repo_id); create index IDXkpkh68n6dy5v51047yr6b0e9l on "Host" (host_name); create index IDXfg2nnjlujxo6cb9fha971bq2n on "HostHistory" (creation_time);