Remove converter for CreateAutoTimestamp (#1429)

We can handle it the same way that we handle UpdateAutoTimestamp, where
we simply populate it in SQL if it doesn't exist. This has the following
benefits:

1. The converter is unnecessary code
2. We get non-null column definitions for free (overridden in
EppResource to allow null creation times so that legacy *History objects
can contain null in that field
3. More importantly, this allows us for proper SQL->DS replay. If the
field is filled out using a converter (as before this PR) then the field
is only actually filled out on transaction commit (rather than when the
write occurs within the transaction). This means that when we serialize
the Transaction object during the transaction (the data that gets
replayed to Datastore), we are crucially missing the creation time.

If the creation time is written on commit, we have to start a new
transaction to write the Transaction object, and it's an absolute
necessity that the record of the transaction be included in the
transaction itself so as to avoid situations where the transaction
succeeds but the record fails.

If the field is filled out in a @PrePersist method, crucially that
occurs on the object write itself (before transaction commit).
This commit is contained in:
gbrodman 2021-11-23 14:56:47 -05:00 committed by GitHub
parent 839d27906a
commit 4368cc8ee0
16 changed files with 118 additions and 182 deletions

View file

@ -572,7 +572,7 @@
client_certificate text,
client_certificate_hash text,
contacts_require_syncing boolean not null,
creation_time timestamptz,
creation_time timestamptz not null,
drive_folder_id text,
email_address text,
failover_client_certificate text,