Also integrated entities into codebase
This commit is contained in:
@@ -3,23 +3,25 @@ use sea_orm_migration::{prelude::*, schema::*};
|
||||
#[derive(DeriveMigrationName)]
|
||||
pub struct Migration;
|
||||
|
||||
// https://github.com/SeaQL/sea-orm/blob/368b1126f73f47c7ec30fe523834f6a0962a193b/sea-orm-migration/src/schema.rs
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
// User table
|
||||
manager
|
||||
.create_table(
|
||||
Table::create()
|
||||
.table(User::Table)
|
||||
.if_not_exists()
|
||||
.col(
|
||||
ColumnDef::new(User::Id)
|
||||
.integer()
|
||||
.not_null()
|
||||
.auto_increment()
|
||||
.primary_key(),
|
||||
)
|
||||
.col(pk_auto(User::Id))
|
||||
.col(string(User::Username))
|
||||
.col(string(User::Password))
|
||||
.col(string(User::Salt))
|
||||
.col(timestamp_with_time_zone(User::CreationTime))
|
||||
.col(timestamp_with_time_zone(User::LastActiveTime))
|
||||
.col(boolean(User::IsAdmin))
|
||||
.col(string_null(User::Email))
|
||||
.col(string_null(User::Avatar))
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
@@ -37,6 +39,11 @@ pub enum User {
|
||||
Table,
|
||||
Id,
|
||||
Username,
|
||||
// Hash
|
||||
Password,
|
||||
Salt,
|
||||
CreationTime,
|
||||
LastActiveTime,
|
||||
IsAdmin,
|
||||
Email,
|
||||
Avatar,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user