Fix similar_artists profile_id column being dropped on every startup
This commit is contained in:
parent
c2af4152ab
commit
3dcf07807c
1 changed files with 53 additions and 47 deletions
|
|
@ -825,6 +825,12 @@ class MusicDatabase:
|
||||||
logger.info("Successfully migrated discovery_recent_albums table for iTunes support")
|
logger.info("Successfully migrated discovery_recent_albums table for iTunes support")
|
||||||
|
|
||||||
# Migration: Add UNIQUE constraint to similar_artists table
|
# Migration: Add UNIQUE constraint to similar_artists table
|
||||||
|
# Skip if table already has profile-scoped UNIQUE constraint (from v3 migration)
|
||||||
|
cursor.execute("SELECT sql FROM sqlite_master WHERE type='table' AND name='similar_artists'")
|
||||||
|
sa_create_sql = cursor.fetchone()
|
||||||
|
has_profile_unique = sa_create_sql and 'UNIQUE(profile_id' in (sa_create_sql[0] or '')
|
||||||
|
|
||||||
|
if not has_profile_unique:
|
||||||
# Test if ON CONFLICT works by trying a dummy operation
|
# Test if ON CONFLICT works by trying a dummy operation
|
||||||
needs_similar_migration = False
|
needs_similar_migration = False
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue