mirror of
https://github.com/google/nomulus.git
synced 2025-07-07 03:33:28 +02:00
Use composite primary key for DomainHistory (#767)
* Use composite primary key for DomainHistory * Move History table's SequenceGenerator to orm.xml * Rebase on HEAD and remove default value for key in History tables * Use primitive type for id. * Revert the cache change
This commit is contained in:
parent
c6c8d21281
commit
ecafebdc3d
10 changed files with 219 additions and 78 deletions
|
@ -14,6 +14,7 @@
|
|||
|
||||
package google.registry.model.history;
|
||||
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.ImmutableObjectSubject.assertAboutImmutableObjects;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
|
||||
|
@ -71,11 +72,15 @@ public class DomainHistoryTest extends EntityTestCase {
|
|||
jpaTm()
|
||||
.transact(
|
||||
() -> {
|
||||
DomainHistory fromDatabase =
|
||||
jpaTm().load(VKey.createSql(DomainHistory.class, domainHistory.getId()));
|
||||
DomainHistory fromDatabase = jpaTm().load(domainHistory.createVKey());
|
||||
assertDomainHistoriesEqual(fromDatabase, domainHistory);
|
||||
assertThat(fromDatabase.getDomainRepoId().getSqlKey())
|
||||
.isEqualTo(domainHistory.getDomainRepoId().getSqlKey());
|
||||
assertThat(fromDatabase.getNsHosts())
|
||||
.containsExactlyElementsIn(
|
||||
domainHistory.getNsHosts().stream()
|
||||
.map(key -> VKey.createSql(HostResource.class, key.getSqlKey()))
|
||||
.collect(toImmutableSet()));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -120,7 +125,7 @@ public class DomainHistoryTest extends EntityTestCase {
|
|||
static void assertDomainHistoriesEqual(DomainHistory one, DomainHistory two) {
|
||||
assertAboutImmutableObjects()
|
||||
.that(one)
|
||||
.isEqualExceptFields(two, "domainContent", "domainRepoId", "parent");
|
||||
.isEqualExceptFields(two, "domainContent", "domainRepoId", "parent", "nsHosts");
|
||||
}
|
||||
|
||||
private DomainHistory createDomainHistory(DomainContent domain) {
|
||||
|
@ -134,7 +139,7 @@ public class DomainHistoryTest extends EntityTestCase {
|
|||
.setReason("reason")
|
||||
.setRequestedByRegistrar(true)
|
||||
.setDomainContent(domain)
|
||||
.setDomainRepoId(domain.createVKey())
|
||||
.setDomainRepoId(domain.getRepoId())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -270,9 +270,9 @@ class google.registry.model.domain.DomainHistory {
|
|||
google.registry.model.domain.Period period;
|
||||
google.registry.model.eppcommon.Trid trid;
|
||||
google.registry.model.reporting.HistoryEntry$Type type;
|
||||
google.registry.persistence.VKey<google.registry.model.domain.DomainBase> domainRepoId;
|
||||
java.lang.Boolean requestedByRegistrar;
|
||||
java.lang.String clientId;
|
||||
java.lang.String domainRepoId;
|
||||
java.lang.String otherClientId;
|
||||
java.lang.String reason;
|
||||
java.util.Set<google.registry.model.reporting.DomainTransactionRecord> domainTransactionRecords;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue