This commit is contained in:
2026-06-22 15:19:46 +01:00
parent de96bc030d
commit 808d6ac5db
21 changed files with 948 additions and 282 deletions
@@ -0,0 +1,48 @@
use sea_orm_migration::prelude::*;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.create_table(
Table::create()
.table(Users::Table)
.if_not_exists()
.col(
ColumnDef::new(Users::Id)
.integer()
.not_null()
.auto_increment()
.primary_key(),
)
.col(
ColumnDef::new(Users::Username)
.string()
.not_null()
.unique_key(),
)
.col(ColumnDef::new(Users::HashedPassword).string())
.col(ColumnDef::new(Users::StreamKeyLimit).integer().default(3))
.to_owned(),
)
.await
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(Table::drop().table(Users::Table).to_owned())
.await
}
}
#[derive(Iden)]
pub enum Users {
Table,
Id,
Username,
HashedPassword,
StreamKeyLimit,
}