fix(tracks): insert tracks breaks playlists

This commit is contained in:
2024-12-16 06:12:05 +01:00
parent 47639dd34a
commit 8b9bf1afce

View File

@@ -219,7 +219,18 @@ pub async fn insert_tracks(
}); });
let mut statement = let mut statement =
tx.prepare("INSERT OR REPLACE INTO tracks (hash, library_path_id, name, artist_id, path, duration) VALUES (?1, ?2, ?3, ?4, ?5, ?6)")?; tx.prepare("
INSERT INTO tracks
(hash, library_path_id, name, artist_id, path, duration)
VALUES
(?1, ?2, ?3, ?4, ?5, ?6)
ON CONFLICT(hash) DO UPDATE SET
library_path_id = ?2,
name = ?3,
artist_id = ?4,
path = ?5,
duration = ?6
")?;
for (hash, meta) in tracks.iter() { for (hash, meta) in tracks.iter() {
statement.execute(params![ statement.execute(params![