upub/migrations/src/m20240628_000002_add_credentials_activated.rs
2025-01-20 23:52:36 +01:00

38 lines
749 B
Rust

use sea_orm_migration::prelude::*;
use crate::m20240524_000003_create_users_auth_and_config::Credentials;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(Credentials::Table)
.add_column(ColumnDef::new(Credentials::Active).boolean().not_null().default(false))
.to_owned()
)
.await?;
Ok(())
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(Credentials::Table)
.drop_column(Credentials::Active)
.to_owned()
)
.await?;
Ok(())
}
}