fix for missing drop column support in sql engine
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Thu, 26 May 2022 07:36:18 +0000 (09:36 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Thu, 26 May 2022 07:36:18 +0000 (09:36 +0200)
music_assistant/helpers/database.py

index 57e8ba35bda7147d361be64174b38927ca7d151c..ef1fc112ddb55764954be6241185f87a1d5bb0e9 100755 (executable)
@@ -218,7 +218,12 @@ class Database:
                         match = {"item_id": db_row["item_id"]}
                         new_values = {"artists": f'[{ db_row["artist"]}]'}
                         await self.update(TABLE_ALBUMS, match, new_values, db=db)
-                    await db.execute(f"ALTER TABLE {TABLE_ALBUMS} DROP COLUMN artist;")
+                    try:
+                        await db.execute(
+                            f"ALTER TABLE {TABLE_ALBUMS} DROP COLUMN artist;"
+                        )
+                    except Exception:  # pylint: disable=broad-except
+                        pass  # old sqlite version
 
             # store current schema version
             await self.set_setting("version", str(SCHEMA_VERSION), db=db)