From 8d8c52634c9dba8bf495fbbbb2f2c178d572cff4 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Wed, 9 Jun 2021 23:37:43 +0200 Subject: [PATCH] Fix account status enum See: https://github.com/adwhit/diesel-derive-enum/issues/62 --- src/models/enums.rs | 1 - src/models/user.rs | 4 ++-- src/schema.rs | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/models/enums.rs b/src/models/enums.rs index ec2d3be..1e46cae 100644 --- a/src/models/enums.rs +++ b/src/models/enums.rs @@ -1,7 +1,6 @@ use diesel_derive_enum::DbEnum; #[derive(Debug, PartialEq, DbEnum, Clone)] -#[DieselType = "AccountStatusEnum"] #[DbValueStyle = "SCREAMING_SNAKE_CASE"] pub enum AccountStatus { CREATED, diff --git a/src/models/user.rs b/src/models/user.rs index d6df1ab..7621b41 100644 --- a/src/models/user.rs +++ b/src/models/user.rs @@ -13,7 +13,7 @@ pub struct User { pub username: String, pub first_name: String, pub last_name: String, - pub account_status: String, + pub account_status: AccountStatus, pub timezone: Option, pub first_log_in_at: Option, pub last_log_in_at: Option, @@ -29,7 +29,7 @@ pub struct NewUser<'a> { pub username: &'a String, pub first_name: &'a String, pub last_name: &'a String, - pub account_status: &'a String, + pub account_status: &'a AccountStatus, pub timezone: Option<&'a String>, pub first_log_in_at: Option<&'a NaiveDateTime>, pub last_log_in_at: Option<&'a NaiveDateTime>, diff --git a/src/schema.rs b/src/schema.rs index d727291..ac9656d 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -9,7 +9,7 @@ table! { username -> Varchar, first_name -> Varchar, last_name -> Varchar, - account_status -> Varchar, + account_status -> AccountStatusMapping, timezone -> Nullable, first_log_in_at -> Nullable, last_log_in_at -> Nullable,