Updates for the "full flow"
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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(WantedItems::Table)
|
||||
.add_column(
|
||||
ColumnDef::new(WantedItems::Name)
|
||||
.text()
|
||||
.not_null()
|
||||
.default(""),
|
||||
)
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.alter_table(
|
||||
Table::alter()
|
||||
.table(WantedItems::Table)
|
||||
.drop_column(WantedItems::Name)
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(DeriveIden)]
|
||||
enum WantedItems {
|
||||
Table,
|
||||
Name,
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
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(WantedItems::Table)
|
||||
.add_column(ColumnDef::new(WantedItems::MusicbrainzId).text())
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
manager
|
||||
.alter_table(
|
||||
Table::alter()
|
||||
.table(WantedItems::Table)
|
||||
.drop_column(WantedItems::MusicbrainzId)
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(DeriveIden)]
|
||||
enum WantedItems {
|
||||
Table,
|
||||
MusicbrainzId,
|
||||
}
|
||||
@@ -7,6 +7,8 @@ mod m20260317_000004_create_wanted_items;
|
||||
mod m20260317_000005_create_download_queue;
|
||||
mod m20260317_000006_create_search_cache;
|
||||
mod m20260317_000007_unique_artist_album;
|
||||
mod m20260317_000009_add_wanted_name;
|
||||
mod m20260317_000010_add_wanted_mbid;
|
||||
|
||||
pub struct Migrator;
|
||||
|
||||
@@ -21,6 +23,8 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20260317_000005_create_download_queue::Migration),
|
||||
Box::new(m20260317_000006_create_search_cache::Migration),
|
||||
Box::new(m20260317_000007_unique_artist_album::Migration),
|
||||
Box::new(m20260317_000009_add_wanted_name::Migration),
|
||||
Box::new(m20260317_000010_add_wanted_mbid::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user