Skip to content

Commit bf2e90c

Browse files
committed
add release disambiguation migration
1 parent 396ce31 commit bf2e90c

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

migration/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ mod m20230712_000001_imports;
1212
mod m20231118_000001_update_artist;
1313
mod m20231126_000001_artist_picture;
1414
mod m20231126_000002_genres;
15+
mod m20231209_000001_release_disambiguation;
1516

1617
pub struct Migrator;
1718

@@ -31,6 +32,7 @@ impl MigratorTrait for Migrator {
3132
Box::new(m20231118_000001_update_artist::Migration),
3233
Box::new(m20231126_000001_artist_picture::Migration),
3334
Box::new(m20231126_000002_genres::Migration),
35+
Box::new(m20231209_000001_release_disambiguation::Migration),
3436
]
3537
}
3638
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use entity::{ReleaseColumn, ReleaseEntity};
2+
use sea_orm::ColumnTrait;
3+
use sea_orm_migration::prelude::*;
4+
use sea_query::Table;
5+
6+
#[derive(DeriveMigrationName)]
7+
pub struct Migration;
8+
9+
#[async_trait::async_trait]
10+
impl MigrationTrait for Migration {
11+
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
12+
let mut binding = Table::alter();
13+
let table =
14+
binding
15+
.table(ReleaseEntity)
16+
.add_column_if_not_exists(&mut ColumnDef::new_with_type(
17+
ReleaseColumn::Disambiguation,
18+
ReleaseColumn::Disambiguation
19+
.def()
20+
.get_column_type()
21+
.clone(),
22+
));
23+
manager.alter_table(table.to_owned()).await?;
24+
Ok(())
25+
}
26+
}

0 commit comments

Comments
 (0)