Make songs conflict on hash, not filename
This commit is contained in:
parent
0490795f02
commit
bb9d2ce11f
|
@ -111,7 +111,7 @@ pub async fn index_source(source: Source, mode: IndexMode, db: &DatabaseConnecti
|
||||||
|
|
||||||
library::Entity::insert(song)
|
library::Entity::insert(song)
|
||||||
.on_conflict(
|
.on_conflict(
|
||||||
sea_query::OnConflict::column(library::Column::Filename)
|
sea_query::OnConflict::column(library::Column::Hash)
|
||||||
.do_nothing()
|
.do_nothing()
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,12 +19,7 @@ impl MigrationTrait for Migration {
|
||||||
.primary_key(),
|
.primary_key(),
|
||||||
)
|
)
|
||||||
.col(ColumnDef::new(Song::Path).string().not_null())
|
.col(ColumnDef::new(Song::Path).string().not_null())
|
||||||
.col(
|
.col(ColumnDef::new(Song::Filename).string().not_null())
|
||||||
ColumnDef::new(Song::Filename)
|
|
||||||
.string()
|
|
||||||
.not_null()
|
|
||||||
.unique_key(),
|
|
||||||
)
|
|
||||||
.col(ColumnDef::new(Song::SourceId).integer().not_null())
|
.col(ColumnDef::new(Song::SourceId).integer().not_null())
|
||||||
.col(ColumnDef::new(Song::Hash).integer().not_null().unique_key())
|
.col(ColumnDef::new(Song::Hash).integer().not_null().unique_key())
|
||||||
.col(ColumnDef::new(Song::Artist).string())
|
.col(ColumnDef::new(Song::Artist).string())
|
||||||
|
|
Loading…
Reference in New Issue