From d6cfb2fdb8993d39812b73fb029f408550e9d9c3 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Sat, 14 Mar 2026 11:49:04 -0700 Subject: [PATCH] Fix watchlist NOT NULL constraint blocking artists without Spotify ID --- database/music_database.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/database/music_database.py b/database/music_database.py index 573db96c..5e21121c 100644 --- a/database/music_database.py +++ b/database/music_database.py @@ -261,7 +261,7 @@ class MusicDatabase: cursor.execute(""" CREATE TABLE IF NOT EXISTS watchlist_artists ( id INTEGER PRIMARY KEY AUTOINCREMENT, - spotify_artist_id TEXT UNIQUE NOT NULL, + spotify_artist_id TEXT UNIQUE, artist_name TEXT NOT NULL, date_added TIMESTAMP DEFAULT CURRENT_TIMESTAMP, last_scan_timestamp TIMESTAMP, @@ -1121,7 +1121,10 @@ class MusicDatabase: if result and 'spotify_artist_id TEXT UNIQUE NOT NULL' in result[0]: logger.info("Migrating watchlist_artists table to make spotify_artist_id nullable...") - + + # Drop leftover temp table from any previous failed migration + cursor.execute("DROP TABLE IF EXISTS watchlist_artists_new") + # Create new table with nullable spotify_artist_id cursor.execute(""" CREATE TABLE watchlist_artists_new ( @@ -1805,6 +1808,9 @@ class MusicDatabase: cols_info = cursor.fetchall() col_names = [c[1] for c in cols_info] + # Drop leftover temp table from any previous failed migration + cursor.execute("DROP TABLE IF EXISTS watchlist_artists_new") + cursor.execute(""" CREATE TABLE watchlist_artists_new ( id INTEGER PRIMARY KEY AUTOINCREMENT,