Files
db/src/migration/m20260320_000013_add_artist_monitoring.rs
T
2026-03-20 16:28:15 -04:00

60 lines
1.5 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> {
manager
.alter_table(
Table::alter()
.table(Artists::Table)
.add_column(
ColumnDef::new(Artists::Monitored)
.boolean()
.not_null()
.default(false),
)
.to_owned(),
)
.await?;
manager
.alter_table(
Table::alter()
.table(Artists::Table)
.add_column(ColumnDef::new(Artists::LastCheckedAt).timestamp())
.to_owned(),
)
.await
}
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.alter_table(
Table::alter()
.table(Artists::Table)
.drop_column(Artists::LastCheckedAt)
.to_owned(),
)
.await?;
manager
.alter_table(
Table::alter()
.table(Artists::Table)
.drop_column(Artists::Monitored)
.to_owned(),
)
.await
}
}
#[derive(DeriveIden)]
enum Artists {
Table,
Monitored,
LastCheckedAt,
}