Add admin column to users table

This commit is contained in:
Ethan Girouard 2024-05-18 20:41:02 -04:00
parent 7bcb5f8c04
commit 6ae55d5cfc
Signed by: eta357
GPG Key ID: 7BCDC36DFD11C146
5 changed files with 6 additions and 0 deletions

View File

@ -0,0 +1 @@
ALTER TABLE users DROP COLUMN admin;

View File

@ -0,0 +1 @@
ALTER TABLE users ADD COLUMN admin BOOLEAN DEFAULT FALSE NOT NULL;

View File

@ -41,6 +41,8 @@ pub struct User {
/// The time the user was created
#[cfg_attr(feature = "ssr", diesel(deserialize_as = SystemTime))]
pub created_at: Option<SystemTime>,
/// Whether the user is an admin
pub admin: bool,
}
/// Model for an artist

View File

@ -25,6 +25,7 @@ pub fn Signup() -> impl IntoView {
email: email.get(),
password: Some(password.get()),
created_at: None,
admin: false,
};
log!("new user: {:?}", new_user);

View File

@ -50,6 +50,7 @@ diesel::table! {
email -> Varchar,
password -> Varchar,
created_at -> Timestamp,
admin -> Bool,
}
}