mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Fixes other temp tables that may have been left behind from a bad migration of the db
This commit is contained in:
parent
bc79c93018
commit
5dbfc81bb2
@ -82,6 +82,9 @@ class ConvertSceneExceptionsToIndexerID(AddXemRefresh):
|
||||
return self.hasColumn("scene_exceptions", "indexer_id")
|
||||
|
||||
def execute(self):
|
||||
if self.hasTable("tmp_scene_exceptions"):
|
||||
self.connection.action("DROP TABLE tmp_scene_exceptions")
|
||||
|
||||
self.connection.action("ALTER TABLE scene_exceptions RENAME TO tmp_scene_exceptions")
|
||||
self.connection.action(
|
||||
"CREATE TABLE scene_exceptions (exception_id INTEGER PRIMARY KEY, indexer_id INTEGER KEY, show_name TEXT)")
|
||||
@ -95,6 +98,9 @@ class ConvertSceneNamesToIndexerID(ConvertSceneExceptionsToIndexerID):
|
||||
return self.hasColumn("scene_names", "indexer_id")
|
||||
|
||||
def execute(self):
|
||||
if self.hasTable("tmp_scene_names"):
|
||||
self.connection.action("DROP TABLE tmp_scene_names")
|
||||
|
||||
self.connection.action("ALTER TABLE scene_names RENAME TO tmp_scene_names")
|
||||
self.connection.action("CREATE TABLE scene_names (indexer_id INTEGER, name TEXT)")
|
||||
self.connection.action("INSERT INTO scene_names(indexer_id, name) SELECT tvdb_id, name FROM tmp_scene_names")
|
||||
|
@ -552,8 +552,9 @@ class ConvertTVShowsToIndexerScheme(AddIndicesToTvEpisodes):
|
||||
|
||||
|
||||
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...")
|
||||
|
||||
if self.hasTable("tmp_tv_shows"):
|
||||
logger.log(u"Removing temp tv show 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")
|
||||
@ -576,6 +577,11 @@ class ConvertTVEpisodesToIndexerScheme(ConvertTVShowsToIndexerScheme):
|
||||
backupDatabase(23)
|
||||
|
||||
logger.log(u"Converting TV Episodes table to Indexer Scheme...")
|
||||
|
||||
if self.hasTable("tmp_tv_episodes"):
|
||||
logger.log(u"Removing temp tv episode tables left behind from previous updates...")
|
||||
self.connection.action("DROP TABLE tmp_tv_episodes")
|
||||
|
||||
self.connection.action("ALTER TABLE tv_episodes RENAME TO tmp_tv_episodes")
|
||||
self.connection.action(
|
||||
"CREATE TABLE tv_episodes (episode_id INTEGER PRIMARY KEY, showid NUMERIC, indexerid NUMERIC, indexer NUMERIC, name TEXT, season NUMERIC, episode NUMERIC, description TEXT, airdate NUMERIC, hasnfo NUMERIC, hastbn NUMERIC, status NUMERIC, location TEXT, file_size NUMERIC, release_name TEXT, subtitles TEXT, subtitles_searchcount NUMERIC, subtitles_lastsearch TIMESTAMP, is_proper NUMERIC)")
|
||||
@ -595,6 +601,11 @@ class ConvertIMDBInfoToIndexerScheme(ConvertTVEpisodesToIndexerScheme):
|
||||
backupDatabase(24)
|
||||
|
||||
logger.log(u"Converting IMDB Info table to Indexer Scheme...")
|
||||
|
||||
if self.hasTable("tmp_imdb_info"):
|
||||
logger.log(u"Removing temp imdb info tables left behind from previous updates...")
|
||||
self.connection.action("DROP TABLE tmp_imdb_info")
|
||||
|
||||
self.connection.action("ALTER TABLE imdb_info RENAME TO tmp_imdb_info")
|
||||
self.connection.action(
|
||||
"CREATE TABLE imdb_info (indexer_id INTEGER PRIMARY KEY, imdb_id TEXT, title TEXT, year NUMERIC, akas TEXT, runtimes NUMERIC, genres TEXT, countries TEXT, country_codes TEXT, certificates TEXT, rating TEXT, votes INTEGER, last_update NUMERIC)")
|
||||
@ -613,6 +624,11 @@ class ConvertInfoToIndexerScheme(ConvertIMDBInfoToIndexerScheme):
|
||||
backupDatabase(25)
|
||||
|
||||
logger.log(u"Converting Info table to Indexer Scheme...")
|
||||
|
||||
if self.hasTable("tmp_info"):
|
||||
logger.log(u"Removing temp info tables left behind from previous updates...")
|
||||
self.connection.action("DROP TABLE tmp_info")
|
||||
|
||||
self.connection.action("ALTER TABLE info RENAME TO tmp_info")
|
||||
self.connection.action(
|
||||
"CREATE TABLE info (last_backlog NUMERIC, last_indexer NUMERIC, last_proper_search NUMERIC)")
|
||||
|
Loading…
Reference in New Issue
Block a user