diff --git a/src/fetching.rs b/src/fetching.rs index 0289458..5993a1e 100644 --- a/src/fetching.rs +++ b/src/fetching.rs @@ -111,7 +111,7 @@ pub async fn index_source(source: Source, mode: IndexMode, db: &DatabaseConnecti library::Entity::insert(song) .on_conflict( - sea_query::OnConflict::column(library::Column::Filename) + sea_query::OnConflict::column(library::Column::Hash) .do_nothing() .to_owned(), ) diff --git a/src/migrator/m20220815_000001_create_library.rs b/src/migrator/m20220815_000001_create_library.rs index 28f202f..54a04ac 100644 --- a/src/migrator/m20220815_000001_create_library.rs +++ b/src/migrator/m20220815_000001_create_library.rs @@ -19,12 +19,7 @@ impl MigrationTrait for Migration { .primary_key(), ) .col(ColumnDef::new(Song::Path).string().not_null()) - .col( - ColumnDef::new(Song::Filename) - .string() - .not_null() - .unique_key(), - ) + .col(ColumnDef::new(Song::Filename).string().not_null()) .col(ColumnDef::new(Song::SourceId).integer().not_null()) .col(ColumnDef::new(Song::Hash).integer().not_null().unique_key()) .col(ColumnDef::new(Song::Artist).string())