fix(sqlite): dedup clears old external id before canonical upsert
This commit is contained in:
@@ -37,6 +37,14 @@ impl MovieDeduplicator for SqliteMovieDeduplicator {
|
||||
.await
|
||||
.map_err(crate::shared::map_sqlx_error)?;
|
||||
|
||||
// The old row still holds the external id (it is deleted last); release it
|
||||
// so the canonical upsert does not violate UNIQUE(external_metadata_id).
|
||||
sqlx::query("UPDATE movies SET external_metadata_id = NULL WHERE id = ?")
|
||||
.bind(&old)
|
||||
.execute(&mut *tx)
|
||||
.await
|
||||
.map_err(crate::shared::map_sqlx_error)?;
|
||||
|
||||
sqlx::query(
|
||||
"INSERT INTO movies (id, external_metadata_id, title, release_year, director, poster_path)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
|
||||
Reference in New Issue
Block a user