[Adonis v6] Model.create behavior with nullable DateTime fields #4980
jvergeldedios
started this conversation in
General
Replies: 2 comments 2 replies
This comment was marked as spam.
This comment was marked as spam.
-
Yes, this is expected, since getting database defaults will require making another DB request, something we want to avoid and should be done explicitly. However, I do agree, it should be mentioned in the docs (if not already) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm on Adonis 6.18.0 and Lucid 21.8.0.
This was previously brought up in this discussion, but I think it's odd behavior for it to be default: https://github.com/orgs/adonisjs/discussions/1859
Given the following model:
And running the following:
But if you follow the advice of the above post and do this instead:
My expectation is that the behavior would be that
Model.create
would return a Promise that resolves with the fully created record, including default null nullable fields. Is this intended behavior or a bug? If it's intended behavior there should probably be a mention of this in the Lucid docs.Beta Was this translation helpful? Give feedback.
All reactions