SeaQL / SeaQL/sea-orm

Non-Enum types require `ActiveEnum` trait when used a primary keys.

Open
#2,435 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:type-map Category:enhancement
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

  1. Create a custom type and implement all necessary traits mentioned here
  2. Use that type inside a sea-orm entity as a primary key
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.