From 58ba03b94bfcbbf52f741a43c459804680fc252e Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 28 Jun 2019 15:27:02 +0200 Subject: [PATCH] Ensure faulty index on Plex DB is correctly recreated on PKC update --- resources/lib/migration.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resources/lib/migration.py b/resources/lib/migration.py index 854679d2..70caabc2 100644 --- a/resources/lib/migration.py +++ b/resources/lib/migration.py @@ -42,4 +42,13 @@ def check_migration(): sections.clear_window_vars() sections.delete_videonode_files() + if not utils.compare_version(last_migration, '2.8.7'): + LOG.info('Migrating to version 2.8.6') + # Need to delete the UNIQUE index that prevents creating several + # playlist entries with the same kodi_hash + from .plex_db import PlexDB + with PlexDB() as plexdb: + plexdb.cursor.execute('DROP INDEX IF EXISTS ix_playlists_3') + # Index will be automatically recreated on next PKC startup + utils.settings('last_migrated_PKC_version', value=v.ADDON_VERSION)