Can I make WhenCreated, WhenModified columns nullable? #3239
Replies: 1 comment 2 replies
-
What we could do is leave the code like: @WhenModified
private OffsetDateTime createdAt; When we generate db migration DDL for this there are 2 things generated being the What we can do is we can manually tweak the generated That is, this mechanism used allows a difference between the actual db migration sql and the "logical model" (where the logical model is defined by the In this way we can have differences between the "physical model" (in terms of sql in the db migrations) and the "logical model". I think it's fair to say this is a feature that can be useful and also can be abused - we don't want to over use this feature. The background to this is that Does that make sense? |
Beta Was this translation helpful? Give feedback.
-
Hi all. I want to add the @WhenCreated and similar annotations to a table that already has data, and has no sensible defaults for the timestamped columns. So ideally I want to use the annotations to populate the auditing columns from now on, but leave existing data null. Is there a way I can do this? I've tried e.g.
But the generated sql makes the column not null regardless.
Thanks for any advice.
Beta Was this translation helpful? Give feedback.
All reactions