1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Small Bugfix

This commit is contained in:
echel0n 2014-03-11 11:33:57 -07:00
parent c97f5b9c70
commit 481fdc1ac6
2 changed files with 35 additions and 31 deletions

View File

@ -59,7 +59,7 @@ class AddNetworkTimezones(AddSceneNameCache):
class ConverSceneExceptionsToIndexerID(AddNetworkTimezones): class ConverSceneExceptionsToIndexerID(AddNetworkTimezones):
def test(self): def test(self):
return self.hasColumn("scene_exceptions", "indexer_id") return self.hasColumn("scene_exceptions", "tvdb_id")
def execute(self): def execute(self):
self.connection.action("ALTER TABLE scene_exceptions RENAME TO tmp_scene_exceptions") self.connection.action("ALTER TABLE scene_exceptions RENAME TO tmp_scene_exceptions")
@ -69,7 +69,7 @@ class ConverSceneExceptionsToIndexerID(AddNetworkTimezones):
class ConverSceneNamesToIndexerID(ConverSceneExceptionsToIndexerID): class ConverSceneNamesToIndexerID(ConverSceneExceptionsToIndexerID):
def test(self): def test(self):
return self.hasColumn("scene_names", "indexer_id") return self.hasColumn("scene_names", "tvdb_id")
def execute(self): def execute(self):
self.connection.action("ALTER TABLE scene_names RENAME TO tmp_scene_names") self.connection.action("ALTER TABLE scene_names RENAME TO tmp_scene_names")

View File

@ -509,6 +509,7 @@ class AddLastConvertTVShowsToIndexerScheme(AddIndicesToTvEpisodes):
def execute(self): def execute(self):
backupDatabase(22) backupDatabase(22)
if self.hasColumn("tv_shows", "tvdb_id"):
logger.log(u"Converting TV Shows table to Indexer Scheme...") logger.log(u"Converting TV Shows table to Indexer Scheme...")
self.connection.action("ALTER TABLE tv_shows RENAME TO 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 TEXT, 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)") self.connection.action("CREATE TABLE tv_shows (show_id INTEGER PRIMARY KEY, indexer_id NUMERIC, indexer TEXT, 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)")
@ -529,6 +530,7 @@ class AddLastConvertTVEpisodesToIndexerScheme(AddLastConvertTVShowsToIndexerSche
def execute(self): def execute(self):
backupDatabase(23) backupDatabase(23)
if self.hasColumn("tv_episodes", "tvdbid"):
logger.log(u"Converting TV Episodes table to Indexer Scheme...") logger.log(u"Converting TV Episodes table to Indexer Scheme...")
self.connection.action("ALTER TABLE tv_episodes RENAME TO 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 TEXT, 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)") self.connection.action("CREATE TABLE tv_episodes (episode_id INTEGER PRIMARY KEY, showid NUMERIC, indexerid NUMERIC, indexer TEXT, 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)")
@ -552,6 +554,7 @@ class AddLastConvertIMDBInfoToIndexerScheme(AddLastConvertTVEpisodesToIndexerSch
def execute(self): def execute(self):
backupDatabase(24) backupDatabase(24)
if self.hasColumn("imdb_info", "tvdb_id"):
logger.log(u"Converting IMDB Info table to Indexer Scheme...") logger.log(u"Converting IMDB Info table to Indexer Scheme...")
self.connection.action("ALTER TABLE imdb_info RENAME TO 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)") 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)")
@ -569,6 +572,7 @@ class AddLastConvertInfoToIndexerScheme(AddLastConvertIMDBInfoToIndexerScheme):
def execute(self): def execute(self):
backupDatabase(25) backupDatabase(25)
if self.hasColumn("info", "last_tvdbid"):
logger.log(u"Converting Info table to Indexer Scheme...") logger.log(u"Converting Info table to Indexer Scheme...")
self.connection.action("ALTER TABLE info RENAME TO tmp_info") self.connection.action("ALTER TABLE info RENAME TO tmp_info")
self.connection.action("CREATE TABLE info (last_backlog NUMERIC, last_indexerid NUMERIC, last_proper_search NUMERIC)") self.connection.action("CREATE TABLE info (last_backlog NUMERIC, last_indexerid NUMERIC, last_proper_search NUMERIC)")