diff --git a/frame/dal/src/db/peace/entity/sea_orm_active_enums.rs b/frame/dal/src/db/peace/entity/sea_orm_active_enums.rs index 07efd3e9..9557e54c 100644 --- a/frame/dal/src/db/peace/entity/sea_orm_active_enums.rs +++ b/frame/dal/src/db/peace/entity/sea_orm_active_enums.rs @@ -1,6 +1,6 @@ //! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.5 -use sea_orm::entity::prelude::*; +use sea_orm::{entity::prelude::*, TryFromU64}; #[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum)] #[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "game_mode")] @@ -96,3 +96,27 @@ pub enum ScoreVersion { #[sea_orm(string_value = "v2")] V2, } + +/// Manually implement [`TryFromU64`] due to [sea-orm #3513](https://github.com/SeaQL/sea-orm/issues/1364) +impl TryFromU64 for PerformanceVersion { + fn try_from_u64(n: u64) -> Result { + match n { + 0 => Ok(Self::V1), + 1 => Ok(Self::V2), + _ => Err(sea_orm::DbErr::Type(format!("Invalid value {}", n))), + } + } +} + +/// Manually implement [`TryFromU64`] due to [sea-orm #3513](https://github.com/SeaQL/sea-orm/issues/1364) +impl TryFromU64 for RankingType { + fn try_from_u64(n: u64) -> Result { + match n { + 0 => Ok(Self::PerformanceV1), + 1 => Ok(Self::PerformanceV2), + 2 => Ok(Self::ScoreV1), + 3 => Ok(Self::ScoreV2), + _ => Err(sea_orm::DbErr::Type(format!("Invalid value {}", n))), + } + } +}