Add a role column to the database and start using it

We cannot yet stop using `admin` because stable will continue writing
it.
This commit is contained in:
Conrad Irwin 2023-10-11 16:34:11 -06:00
parent be1800884e
commit 690d9fb971
10 changed files with 76 additions and 30 deletions

View file

@ -1,7 +1,7 @@
use crate::db::{channel_member, ChannelId, ChannelMemberId, UserId};
use crate::db::{channel_member, ChannelId, ChannelMemberId, ChannelRole, UserId};
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, Default, PartialEq, Eq, DeriveEntityModel)]
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "channel_members")]
pub struct Model {
#[sea_orm(primary_key)]
@ -10,6 +10,8 @@ pub struct Model {
pub user_id: UserId,
pub accepted: bool,
pub admin: bool,
// only optional while migrating
pub role: Option<ChannelRole>,
}
impl ActiveModelBehavior for ActiveModel {}