All checks were successful
continuous-integration/drone/push Build is passing
51 lines
1.5 KiB
Rust
51 lines
1.5 KiB
Rust
use neo_entity::users::{self, Entity as User};
|
|
use sea_orm_migration::prelude::*;
|
|
|
|
pub struct Migration;
|
|
|
|
impl MigrationName for Migration {
|
|
fn name(&self) -> &str {
|
|
"m20220707_092851_create_users"
|
|
}
|
|
}
|
|
|
|
#[async_trait::async_trait]
|
|
impl MigrationTrait for Migration {
|
|
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
|
manager
|
|
.create_table(
|
|
Table::create()
|
|
.table(User)
|
|
.if_not_exists()
|
|
.col(
|
|
ColumnDef::new(users::Column::Uuid)
|
|
.uuid()
|
|
.primary_key()
|
|
.not_null(),
|
|
)
|
|
.col(ColumnDef::new(users::Column::UserId).string().not_null())
|
|
.col(
|
|
ColumnDef::new(users::Column::DisplayName)
|
|
.string()
|
|
.not_null(),
|
|
)
|
|
.col(
|
|
ColumnDef::new(users::Column::PasswordHash)
|
|
.string()
|
|
.not_null(),
|
|
)
|
|
.to_owned(),
|
|
)
|
|
.await?;
|
|
manager
|
|
.create_index(
|
|
Index::create()
|
|
.name("user_id_index")
|
|
.table(User)
|
|
.col(users::Column::UserId)
|
|
.to_owned(),
|
|
)
|
|
.await
|
|
}
|
|
}
|