From 4080cfbfc8c0cd94287d23d8b3ac05df6b338c4b Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 19 Jan 2026 20:07:32 -0600 Subject: [PATCH] Add cleanup of temp table in sample rate migration Drop any existing local_tracks_new table before starting migration to handle cases where a previous migration attempt failed mid-execution. This prevents 'table already exists' errors when retrying the migration. --- src-tauri/src/library/database.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src-tauri/src/library/database.rs b/src-tauri/src/library/database.rs index e4c6f8f1b..b0f479352 100644 --- a/src-tauri/src/library/database.rs +++ b/src-tauri/src/library/database.rs @@ -362,6 +362,9 @@ impl LibraryDatabase { // CRITICAL: Explicitly list all columns to handle different DB versions safely self.conn.execute_batch( r#" + -- Clean up any leftover temp table from previous failed migration + DROP TABLE IF EXISTS local_tracks_new; + -- Create new table with REAL sample_rate (only core columns) CREATE TABLE local_tracks_new ( id INTEGER PRIMARY KEY,