diff --git a/gpodder/src/models.rs b/gpodder/src/models.rs index 2f77ba1..fb9339b 100644 --- a/gpodder/src/models.rs +++ b/gpodder/src/models.rs @@ -5,6 +5,7 @@ pub struct User { pub id: i64, pub username: String, pub password_hash: String, + pub admin: bool, } #[derive(Clone, Debug, PartialEq, Eq)] diff --git a/gpodder_sqlite/migrations/2025-06-24-110307_user_admin_field/down.sql b/gpodder_sqlite/migrations/2025-06-24-110307_user_admin_field/down.sql new file mode 100644 index 0000000..40a39a7 --- /dev/null +++ b/gpodder_sqlite/migrations/2025-06-24-110307_user_admin_field/down.sql @@ -0,0 +1,2 @@ +alter table users + drop column admin; diff --git a/gpodder_sqlite/migrations/2025-06-24-110307_user_admin_field/up.sql b/gpodder_sqlite/migrations/2025-06-24-110307_user_admin_field/up.sql new file mode 100644 index 0000000..3a04ac9 --- /dev/null +++ b/gpodder_sqlite/migrations/2025-06-24-110307_user_admin_field/up.sql @@ -0,0 +1,2 @@ +alter table users + add column admin boolean not null default false; diff --git a/gpodder_sqlite/src/models/user.rs b/gpodder_sqlite/src/models/user.rs index 72ea62b..d0222ec 100644 --- a/gpodder_sqlite/src/models/user.rs +++ b/gpodder_sqlite/src/models/user.rs @@ -9,6 +9,7 @@ pub struct User { pub id: i64, pub username: String, pub password_hash: String, + pub admin: bool, } #[derive(Insertable)] diff --git a/gpodder_sqlite/src/repository/auth.rs b/gpodder_sqlite/src/repository/auth.rs index e32ff85..26e5ad3 100644 --- a/gpodder_sqlite/src/repository/auth.rs +++ b/gpodder_sqlite/src/repository/auth.rs @@ -18,6 +18,7 @@ impl From for gpodder::User { id: value.id, username: value.username, password_hash: value.password_hash, + admin: value.admin, } } } diff --git a/gpodder_sqlite/src/schema.rs b/gpodder_sqlite/src/schema.rs index 990293d..438a63d 100644 --- a/gpodder_sqlite/src/schema.rs +++ b/gpodder_sqlite/src/schema.rs @@ -58,6 +58,7 @@ diesel::table! { id -> BigInt, username -> Text, password_hash -> Text, + admin -> Bool, } }