Add admin column to users table
This commit is contained in:
parent
7bcb5f8c04
commit
6ae55d5cfc
1
migrations/2024-05-18-231505_add_user_admin/down.sql
Normal file
1
migrations/2024-05-18-231505_add_user_admin/down.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE users DROP COLUMN admin;
|
1
migrations/2024-05-18-231505_add_user_admin/up.sql
Normal file
1
migrations/2024-05-18-231505_add_user_admin/up.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE users ADD COLUMN admin BOOLEAN DEFAULT FALSE NOT NULL;
|
@ -41,6 +41,8 @@ pub struct User {
|
|||||||
/// The time the user was created
|
/// The time the user was created
|
||||||
#[cfg_attr(feature = "ssr", diesel(deserialize_as = SystemTime))]
|
#[cfg_attr(feature = "ssr", diesel(deserialize_as = SystemTime))]
|
||||||
pub created_at: Option<SystemTime>,
|
pub created_at: Option<SystemTime>,
|
||||||
|
/// Whether the user is an admin
|
||||||
|
pub admin: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Model for an artist
|
/// Model for an artist
|
||||||
|
@ -25,6 +25,7 @@ pub fn Signup() -> impl IntoView {
|
|||||||
email: email.get(),
|
email: email.get(),
|
||||||
password: Some(password.get()),
|
password: Some(password.get()),
|
||||||
created_at: None,
|
created_at: None,
|
||||||
|
admin: false,
|
||||||
};
|
};
|
||||||
log!("new user: {:?}", new_user);
|
log!("new user: {:?}", new_user);
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ diesel::table! {
|
|||||||
email -> Varchar,
|
email -> Varchar,
|
||||||
password -> Varchar,
|
password -> Varchar,
|
||||||
created_at -> Timestamp,
|
created_at -> Timestamp,
|
||||||
|
admin -> Bool,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user