web3-proxy/migration/src/m20230130_124740_read_only_...
Bryan Stitt b87c988439 lint
2023-03-01 11:23:59 -08:00

42 lines
1.0 KiB
Rust

use sea_orm_migration::prelude::*;
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
// Add a read-only column to the table
manager
.alter_table(
Table::alter()
.table(Login::Table)
.add_column(ColumnDef::new(Login::ReadOnly).boolean().not_null())
.to_owned(),
)
.await
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
// Drop the column from the table ...
manager
.alter_table(
Table::alter()
.table(Login::Table)
.drop_column(Login::ReadOnly)
.to_owned(),
)
.await
}
}
/// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)]
enum Login {
Table,
// Id,
// BearerToken,
ReadOnly,
// UserId,
}