Skip to content
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

Generate select_as and save_as attributes for custom column types. #2081

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucasmerlin
Copy link

PR Info

New Features

  • Generate select_as and save_as attributes to automatically cast custom types
    Before, using custom types in postgres resulted in a error like this:
DatabaseError occurred: Query Error: error occurred while decoding column "email": mismatched types; Rust type `core::option::Option<alloc::string::String>` (as SQL type `TEXT`) is not compatible with SQL type `citext`

Now it will be casted correctly.

I am not sure what the implications of adding select_as and save_as are for other database backends, since I believe this is only needed for postgres? So maybe it will need to be made configurable or only be enabled for postgres. Some feedback on this would be appreciated.

I've tested these changes in my codebase where it works great.

Breaking Changes

  • Custom types will now have the select_as and save_as attributes generated. But since they wouldn't have been usable before, at least with postgres, I'm not sure if this is a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sea-orm-cli generate entity migration select_as, save_as support
1 participant