#237 fix: give auto temporal columns a database default in migrations - #238
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #237
A column marked
#[auto]is excluded from the generatedINSERT, but the DDL emittedDEFAULTonly when one was written by hand. A table created fromMIGRATION_UPtherefore rejected the firstcreate()with23502 not-null violation— including for the entity shape used in the README quick start.Non-nullable
#[auto]columns with a temporal type now receive the matching clock default:TIMESTAMPTZ,TIMESTAMPNOW()DATECURRENT_DATETIME,TIMETZCURRENT_TIMEAn explicit
#[column(default = "...")]still wins. Nullable auto columns, arrays and non-temporal types are untouched — the macro has no meaningful value to invent there, and a nullable column already accepts the absent value.Verification
The live-Postgres entity from #234 drops its
#[column(default = "NOW()")]workaround, socrud_roundtripnow fails without this fix and passes with it. Three unit tests cover the clock defaults, the explicit-default precedence, and the untouched cases.Docs
#[auto]documentation updated in the README attribute reference and in the attribute page of all five wiki languages.