-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
BigDecimal is not supported by codegen #1530
Comments
mattiekat
changed the title
BigDecimal with codegen
BigDecimal is not supported by codegen
Mar 9, 2023
There is a PR is welcomed |
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
The auto-generated
Model
defaults toDecimal
which breaks whenwith-rust_decimal
is disabled andwith-bigdecimal
is enabled.Also the docs do not list
BigDecimal
as a valid numeric/decimal type.https://www.sea-ql.org/SeaORM/docs/generate-entity/entity-structure/#column-type
Steps to Reproduce
I have a postgres table defined with a migration
that works without issue but then when I generate an entity using the
sea-orm-cli
it generates an invalidModel
implementation ofExpected Behavior
Fundamentally I expect it to generate code that compiles, however, I am not sure if the right approach here is to figure out somehow that it should use
BigDecimal
during codegen or if it should aliasBigDecimal
asDecimal
when only the one feature flag is enabled.If both feature flags are enabled I think it would be appropriate to default to one or the other and leave it up to the user to manually change them as needed. I would lean towards defaulting to
BigDecimal
as it is not a default feature flag so having both active implies it is the preference. I don't have particularly strong feelings on this case since I think most people (myself for sure) will decide to use just one or the other exclusively, though, it is not improbable that someone will accidentally not disable the default feature flag.Actual Behavior
Generated code that does not compile with the chosen feature flags.
Reproduces How Often
Reliably
Workarounds
For now I am just manually replacing all generated
Decimal
references withBigDecimal
.Reproducible Example
Non-trivial as it requires generating code from a live database.
Versions
postgres 15
The text was updated successfully, but these errors were encountered: