1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Add minimum chat moderation to enable bans for #22

This commit is contained in:
NG (Graham)
2025-05-29 20:55:36 -04:00
parent 9d9f8a73fc
commit c441b8b5ef
15 changed files with 467 additions and 7 deletions

View File

@@ -0,0 +1,65 @@
use sea_orm_migration::prelude::*;
pub struct Migration;
impl MigrationName for Migration {
fn name(&self) -> &str {
"m20250529_000001_create_sanction_table"
}
}
#[async_trait::async_trait]
impl MigrationTrait for Migration {
// Define how to apply this migration: Create the Sanctions table.
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.create_table(
Table::create()
.table(crate::schema::sanction::Entity)
.col(
ColumnDef::new(crate::schema::sanction::Column::Id)
.unsigned()
.not_null()
.auto_increment()
.primary_key(),
)
.col(ColumnDef::new(crate::schema::sanction::Column::UserId).unsigned().not_null())
.foreign_key(
ForeignKey::create()
.name("fk-sanction-user_id")
.from(crate::schema::sanction::Entity, crate::schema::sanction::Column::UserId)
.to(crate::schema::user::Entity, crate::schema::user::Column::Id),
)
.col(ColumnDef::new(crate::schema::sanction::Column::CreationTime).big_integer().not_null())
.col(ColumnDef::new(crate::schema::sanction::Column::IssuerId).unsigned().not_null())
.foreign_key(
ForeignKey::create()
.name("fk-sanction-issuer_id")
.from(crate::schema::sanction::Entity, crate::schema::sanction::Column::IssuerId)
.to(crate::schema::user::Entity, crate::schema::user::Column::Id),
)
.col(ColumnDef::new(crate::schema::sanction::Column::IssuerName).string().not_null())
.col(ColumnDef::new(crate::schema::sanction::Column::Descriptor).string().not_null())
.col(ColumnDef::new(crate::schema::sanction::Column::Reason).string().not_null())
.col(ColumnDef::new(crate::schema::sanction::Column::Duration).big_integer())
.col(ColumnDef::new(crate::schema::sanction::Column::Acknowledged).big_integer())
.col(ColumnDef::new(crate::schema::sanction::Column::AppealerId).unsigned())
.foreign_key(
ForeignKey::create()
.name("fk-sanction-appealer_id")
.from(crate::schema::sanction::Entity, crate::schema::sanction::Column::AppealerId)
.to(crate::schema::user::Entity, crate::schema::user::Column::Id),
)
.col(ColumnDef::new(crate::schema::sanction::Column::AppealTime).big_integer())
.to_owned(),
)
.await
}
// Define how to rollback this migration: Drop the Sanctions table.
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(Table::drop().table(crate::schema::sanction::Entity).to_owned())
.await
}
}

View File

@@ -6,6 +6,7 @@ mod m20250424_000003_create_garage_table;
mod m20250424_000004_create_user_aux_table;
mod m20250424_000005_create_campaign_tables;
mod m20250526_000001_add_garage_customisation;
mod m20250529_000001_create_sanction_table;
pub struct Migrator;
@@ -19,6 +20,7 @@ impl MigratorTrait for Migrator {
Box::new(m20250424_000004_create_user_aux_table::Migration),
Box::new(m20250424_000005_create_campaign_tables::Migration),
Box::new(m20250526_000001_add_garage_customisation::Migration),
Box::new(m20250529_000001_create_sanction_table::Migration),
]
}
}