From bc79c930185ebfe5a7a3b55f98bd20eaa41f0a32 Mon Sep 17 00:00:00 2001 From: echel0n Date: Tue, 22 Apr 2014 10:52:14 -0700 Subject: [PATCH] Fixes issue with previous db migrations that failed and left behind tables that should have been dropped. --- sickbeard/databases/mainDB.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sickbeard/databases/mainDB.py b/sickbeard/databases/mainDB.py index 87f9aa97..9c08012e 100644 --- a/sickbeard/databases/mainDB.py +++ b/sickbeard/databases/mainDB.py @@ -550,7 +550,12 @@ class ConvertTVShowsToIndexerScheme(AddIndicesToTvEpisodes): def execute(self): backupDatabase(22) + logger.log(u"Converting TV Shows table to Indexer Scheme...") + if self.hasTable('tmp_tv_shows'): + logger.log(u"Removing temp tables left behind from previous updates...") + self.connection.action("DROP TABLE tmp_tv_shows") + self.connection.action("ALTER TABLE tv_shows RENAME TO tmp_tv_shows") self.connection.action( "CREATE TABLE tv_shows (show_id INTEGER PRIMARY KEY, indexer_id NUMERIC, indexer NUMBERIC, show_name TEXT, location TEXT, network TEXT, genre TEXT, classification TEXT, runtime NUMERIC, quality NUMERIC, airs TEXT, status TEXT, flatten_folders NUMERIC, paused NUMERIC, startyear NUMERIC, air_by_date NUMERIC, lang TEXT, subtitles NUMERIC, notify_list TEXT, imdb_id TEXT, last_update_indexer NUMERIC, dvdorder NUMERIC)")