Non-Enum types require `ActiveEnum` trait when used a primary keys.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.9k
- Forks
- 734
- Avg merge
- 6h 36m
- Merged PRs (30d)
- 8
Description
Description
See here: https://github.com/SeaQL/sea-orm/discussions/1807
It's been unanswered for more than a year and it isn't really a discussion and more like a bug.
In my case I have a wrapper type (named Snowflake) around i64 rust type.
So for every trait that needs to be implemented I can just call the appropriate method on i64 but ActiveEnum is not implemented for it but I can still use it as a primary key?
Steps to Reproduce
- Create a custom type and implement all necessary traits mentioned here
- Use that type inside a sea-orm entity as a primary key
- try
cargo build
Expected Behavior
I dont need to implement ActiveEnum traits for non-enum types.
Actual Behavior
It requires me to do so.
Reproduces How Often
Everytime
Workarounds
Non / Custom types are unuseable here.
Reproducible Example
See discussion
Versions
1.1.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked discussion 1807 and the newtype guidance in the SeaORM documentation, then reproduce the issue using a Snowflake wrapper as a primary key and run cargo build. Done means a non-enum custom primary-key type can compile without implementing ActiveEnum.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100