Add initial database schema and references
Some checks are pending
Build Crate / build (push) Waiting to run

Also look into users a bit
This commit is contained in:
2024-08-14 01:20:48 -04:00
parent 01eaf059dd
commit 5cb67786bf
19 changed files with 505 additions and 6 deletions

View File

@@ -0,0 +1,42 @@
use sea_orm_migration::{prelude::*, schema::*};
#[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(User::Table)
.if_not_exists()
.col(
ColumnDef::new(User::Id)
.integer()
.not_null()
.auto_increment()
.primary_key(),
)
.col(string(User::Username))
.col(string(User::Password))
.to_owned(),
)
.await
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(Table::drop().table(User::Table).to_owned())
.await
}
}
#[derive(DeriveIden)]
pub enum User {
Table,
Id,
Username,
// Hash
Password,
}