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

Unknown types could be a newtypes instead of ActiveEnum #324

Merged
merged 4 commits into from
Nov 17, 2021

Conversation

billy1624
Copy link
Member

Hey, I am getting this error for my newtypes that I'm using in my model:

error[E0277]: the trait bound `user::types::RoleName: sea_orm::ActiveEnum` is not satisfied
   --> src/domain/user/model/role.rs:20:5
    |
20  |     name: RoleName,
    |     ^^^^ the trait `sea_orm::ActiveEnum` is not implemented for `user::types::RoleName`
    |
note: required by `db_type`
   --> /home/muhannad/.cargo/git/checkouts/sea-orm-22c73aa2bf417e13/d66538d/src/entity/active_enum.rs:121:5
    |
121 |     fn db_type() -> ColumnDef;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^

I'm using the git version
here is my model struct:

#[derive(
    Serialize, Deserialize, Debug, PartialEq, PartialOrd, Eq, Ord, Clone, DeriveEntityModel,
)]
#[sea_orm(table_name = "roles")]
pub struct Model {
    #[sea_orm(primary_key)]
    id: RoleId,
    name: RoleName,
    locked: bool,

    // creation info
    created_at: DateTime,
    created_by_domain: DomainName,
    created_by_user: Option<AccountId>,
}

it seems I'm getting this error for all fields with newtype/custom types

Originally posted by @MuhannadAlrusayni on Discord

@billy1624 billy1624 self-assigned this Nov 16, 2021
@billy1624 billy1624 marked this pull request as ready for review November 16, 2021 14:40
@billy1624 billy1624 mentioned this pull request Nov 17, 2021
10 tasks
Copy link
Member

@tyt2y3 tyt2y3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great

@tyt2y3 tyt2y3 merged commit aff988b into master Nov 17, 2021
@tyt2y3 tyt2y3 deleted the hotfix-custom-types branch November 17, 2021 08:47
@MuhannadAlrusayni
Copy link
Contributor

Well done @billy1624, cannot wait to try that!.

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.

3 participants