Fixed database cleanup

This commit is contained in:
krateng 2022-02-18 08:13:31 +01:00
parent e980efa731
commit 900ce51af0
1 changed files with 8 additions and 6 deletions

View File

@ -575,12 +575,14 @@ def clean_db():
log(f"Deleted {a2} tracks without scrobbles ({a1} track artist entries)")
### Delete artists that have no tracks (will remove defined associates, not sure if leaving like this)
a3 = conn.execute(sql.text('''
delete from artists where id not in (select artist_id from trackartists)
''')).rowcount
log(f"Deleted {a3} artists without tracks")
### Delete artists that have no tracks
# we actually don't wanna do that as it will break collection artists
# that don't have songs themselves
#a3 = conn.execute(sql.text('''
# delete from artists where id not in (select artist_id from trackartists)
#''')).rowcount
#
#log(f"Deleted {a3} artists without tracks")
### Delete tracks that have no artists (delete their scrobbles first)
a4 = conn.execute(sql.text('''