diff --git a/migration/src/lib.rs b/migration/src/lib.rs index a964e8d..34b7761 100644 --- a/migration/src/lib.rs +++ b/migration/src/lib.rs @@ -12,6 +12,7 @@ mod m20230712_000001_imports; mod m20231118_000001_update_artist; mod m20231126_000001_artist_picture; mod m20231126_000002_genres; +mod m20231209_000001_release_disambiguation; pub struct Migrator; @@ -31,6 +32,7 @@ impl MigratorTrait for Migrator { Box::new(m20231118_000001_update_artist::Migration), Box::new(m20231126_000001_artist_picture::Migration), Box::new(m20231126_000002_genres::Migration), + Box::new(m20231209_000001_release_disambiguation::Migration), ] } } diff --git a/migration/src/m20231209_000001_release_disambiguation.rs b/migration/src/m20231209_000001_release_disambiguation.rs new file mode 100644 index 0000000..cc05bfc --- /dev/null +++ b/migration/src/m20231209_000001_release_disambiguation.rs @@ -0,0 +1,26 @@ +use entity::{ReleaseColumn, ReleaseEntity}; +use sea_orm::ColumnTrait; +use sea_orm_migration::prelude::*; +use sea_query::Table; + +#[derive(DeriveMigrationName)] +pub struct Migration; + +#[async_trait::async_trait] +impl MigrationTrait for Migration { + async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { + let mut binding = Table::alter(); + let table = + binding + .table(ReleaseEntity) + .add_column_if_not_exists(&mut ColumnDef::new_with_type( + ReleaseColumn::Disambiguation, + ReleaseColumn::Disambiguation + .def() + .get_column_type() + .clone(), + )); + manager.alter_table(table.to_owned()).await?; + Ok(()) + } +}