mirror of
https://github.com/google/nomulus
synced 2026-10-01 12:16:02 +00:00
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:
@@ -0,0 +1,15 @@
|
||||
-- Copyright 2021 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.
|
||||
|
||||
ALTER TABLE "Registrar" ALTER COLUMN creation_time SET NOT NULL;
|
||||
Reference in New Issue
Block a user