42 lines
1.3 KiB
Rust
42 lines
1.3 KiB
Rust
use loco_rs::schema::*;
|
|
use sea_orm_migration::prelude::*;
|
|
|
|
#[derive(DeriveMigrationName)]
|
|
pub struct Migration;
|
|
|
|
#[async_trait::async_trait]
|
|
impl MigrationTrait for Migration {
|
|
async fn up(&self, m: &SchemaManager) -> Result<(), DbErr> {
|
|
create_table(
|
|
m,
|
|
"users",
|
|
&[
|
|
("id", ColType::PkAuto),
|
|
("pid", ColType::Uuid),
|
|
("email", ColType::StringUniq),
|
|
("password", ColType::String),
|
|
("api_key", ColType::StringUniq),
|
|
("name", ColType::String),
|
|
("reset_token", ColType::StringNull),
|
|
("reset_sent_at", ColType::TimestampWithTimeZoneNull),
|
|
("email_verification_token", ColType::StringNull),
|
|
(
|
|
"email_verification_sent_at",
|
|
ColType::TimestampWithTimeZoneNull,
|
|
),
|
|
("email_verified_at", ColType::TimestampWithTimeZoneNull),
|
|
("magic_link_token", ColType::StringNull),
|
|
("magic_link_expiration", ColType::TimestampWithTimeZoneNull),
|
|
],
|
|
&[],
|
|
)
|
|
.await?;
|
|
Ok(())
|
|
}
|
|
|
|
async fn down(&self, m: &SchemaManager) -> Result<(), DbErr> {
|
|
drop_table(m, "users").await?;
|
|
Ok(())
|
|
}
|
|
}
|