-
-
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
Column names with single letters separated by underscores are concatenated #630
Comments
Okay I figured out the issue. The relevant derive macros only deal with the This wouldn't be fixed with a reimplementation of The best way to fix this, as far I can see, would be to remove the Alternatively, Another idea would be to have the Not sure when or if I'd have time to submit a PR, but I'm interested which if any of these approaches appeals to y'all. |
Thank you for the investigation and explanation. I think the above is definitely doable |
It looks like that wouldn't totally fix it---I'm looking at the If you don't want to do the Column impl in the DeriveEntityModel derive using the fields directly, maybe a set of attributes could be added to the DeriveColumn macro to handle this case? Like the Alternatively, the column enum variants could have unmodified snake_case names instead of PascalCase-ing them at all. |
Hey @e-rhodes, sorry for the delay. Please check #695 |
Description
A table with column names that include single letters separated by underscores are not queried correctly. All underscores dividing only single letters are removed.
For example, a column with the name
a_b_c_d
will be queried asabcd
, while a column with the namea_b_cc_d
will be queried asab_cc_d
.Steps to Reproduce
Expected Behavior
The fields will be queried with their correct names.
Actual Behavior
The names are changed and so the query fails.
Reproduces How Often
Every time.
Versions
Seen on Windows 11 and Ubuntu 20.04 (through WSL) with a MySQL database (5.7 and 8.0).
Dependency graph:
Additional Information
Repository showing the issue
You can work around this issue by including a
#[sea_orm(column_name = "correct_name")]
on the field, but this is obviously less than ideal as it's a lot of boilerplate and opportunity for errors that are difficult to track down if you mess up the name.The text was updated successfully, but these errors were encountered: