You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The generated entity fails to compile with the following error:
error[E0277]: the trait bound `sea_orm_active_enums::Version: TryFromU64` is not satisfied
--> demo.rs
||#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]| ^^^^^^^^^^^^^^^^^ the trait `TryFromU64` is not implemented for`sea_orm_active_enums::Version`|
= help: the following other types implement trait `TryFromU64`:
(A, B)
(A, B, C)
(A, B, C, D)
(A, B, C, D, E)
(A, B, C, D, E, F)
JsonValue
Vec<u8>
bool
and 23 others
= note: required for`(i64, sea_orm_active_enums::Version)` to implement `TryFromU64`
note: required by a bound in`sea_orm::PrimaryKeyTrait::ValueType`
--> sea-orm-0.10.5\src\entity\primary_key.rs:49:11
|
49 | + TryFromU64;| ^^^^^^^^^^ required by this bound in`sea_orm::PrimaryKeyTrait::ValueType`
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
Steps to Reproduce
Create a table and execute migrate up
use sea_orm_migration::prelude::*;#[derive(Iden)]pubenumReport{Table,Id,Version,}#[derive(Iden)]pubenumVersion{#[iden = "version"]Enum = -1,#[iden = "v1"]V1,#[iden = "v2"]V2,}pubfncreate_table() -> TableCreateStatement{Table::create().table(Report::Table).if_not_exists().col(ColumnDef::new(Report::Id).big_integer().not_null()).col(ColumnDef::new(Report::Version).enumeration(Version::Enum,[Version::V1,Version::V2]).not_null().default(Version::V1.to_string()),).primary_key(// Form composite primary key with enum
sea_query::Index::create().col(Report::Id).col(Report::Version),).to_owned()}
Expected Behavior
Actual Behavior
Reproduces How Often
Versions
Additional Information
The text was updated successfully, but these errors were encountered:
Pure-Peace
added a commit
to Pure-Peace/peace
that referenced
this issue
Jan 5, 2023
impl<T>TryFromU64forTwhereT:ActiveEnum,{fntry_from_u64(_:u64) -> Result<Self,DbErr>{Err(DbErr::ConvertFromU64("Fail to construct ActiveEnum from a u64, if your primary key consist of a ActiveEnum field, its auto increment should be set to false."))}}
Description
Composite primary key with enum causes generated entity to fail to compile.
Entities generated from the database:
The generated entity fails to compile with the following error:
Steps to Reproduce
Create a table and execute migrate up
Expected Behavior
Actual Behavior
Reproduces How Often
Versions
Additional Information
The text was updated successfully, but these errors were encountered: