-
-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add default_expr support for ColumnDef #1474
Add default_expr support for ColumnDef #1474
Conversation
I had certain questions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Diwakar-Gupta, thanks for contributing!!
- Should I add a test for
default_expr
and may bedefault_value
?
Yes, please!
- Should I comment test for now.
I think it's possible to implement PartialEq
for sea_query::SimpleExpr
but it's not trivial. I can try though.
Thanks I will do that, additionally if you are going to impl ** |
We discussed a while before. The gist is But I imagine it could be implemented as follows: (*self).get_type_id() == (*other).get_type_id() && self.to_string() == other.to_string() Checking type id is necessary, because two types with the same name is not deemed to be equal. |
9f67895
to
951df65
Compare
Hey @Diwakar-Gupta @tyt2y3, I just did a POC, SeaQL/sea-query#620. |
Hello! Why do we need |
Here. It's used during tests. |
Hey @Diwakar-Gupta, I just upgraded SeaQuery dependency to SeaQL/sea-query#620 |
2029220
to
89e358e
Compare
Hey @Diwakar-Gupta, don't worry about the error at https://github.com/SeaQL/sea-orm/actions/runs/4500149841/jobs/7918900727?pr=1474. The root cause is that SeaORM and SeaSchema depend on two different version of SeaQuery. We can fix it after SeaQL/sea-query#620 has been merged. |
I see that this PR was merged, is there still integration / release / deps work remaining? Am just curious what to keep an eye on regarding blockers / next-steps. :D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for the PR!! @Diwakar-Gupta
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you all
🎉 Released In 0.12.1 🎉Thank you everyone for the contribution! |
PR Info
Fixes
#1398 and #826
File Changed
sea-orm-macros/src/derives/entity_model.rs
parse attribute and generate function call.src/entity/column.rs
updated ColumnDef to storeSimpleExpr
instead ofValue
and updateddefault_value
function.Tests
Have removed
PartialEq
fromColumnDef
becauseSimpleExpr
does not implementPartialEq
, thats why test usingassert_eq
onColumnDef
are failing.To make a temporarily fix we can implementing
eq
method forColumnDef
for test only and for supported features only.