Fix watchlist NOT NULL constraint blocking artists without Spotify ID
This commit is contained in:
parent
fc90ed68a3
commit
d6cfb2fdb8
1 changed files with 8 additions and 2 deletions
|
|
@ -261,7 +261,7 @@ class MusicDatabase:
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
CREATE TABLE IF NOT EXISTS watchlist_artists (
|
CREATE TABLE IF NOT EXISTS watchlist_artists (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
spotify_artist_id TEXT UNIQUE NOT NULL,
|
spotify_artist_id TEXT UNIQUE,
|
||||||
artist_name TEXT NOT NULL,
|
artist_name TEXT NOT NULL,
|
||||||
date_added TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
date_added TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
last_scan_timestamp TIMESTAMP,
|
last_scan_timestamp TIMESTAMP,
|
||||||
|
|
@ -1122,6 +1122,9 @@ class MusicDatabase:
|
||||||
if result and 'spotify_artist_id TEXT UNIQUE NOT NULL' in result[0]:
|
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...")
|
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
|
# Create new table with nullable spotify_artist_id
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
CREATE TABLE watchlist_artists_new (
|
CREATE TABLE watchlist_artists_new (
|
||||||
|
|
@ -1805,6 +1808,9 @@ class MusicDatabase:
|
||||||
cols_info = cursor.fetchall()
|
cols_info = cursor.fetchall()
|
||||||
col_names = [c[1] for c in cols_info]
|
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("""
|
cursor.execute("""
|
||||||
CREATE TABLE watchlist_artists_new (
|
CREATE TABLE watchlist_artists_new (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue