mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-11 05:33:37 +00:00
Merge branch 'hotfix/0.11.16'
This commit is contained in:
commit
48cb3008cf
4 changed files with 52 additions and 7 deletions
|
@ -1,4 +1,9 @@
|
|||
### 0.11.15 (2016-09-13 19:50:00 UTC)
|
||||
### 0.11.16 (2016-10-16 17:30:00 UTC)
|
||||
|
||||
* Change ensure a cache.db table does exist on migration
|
||||
|
||||
|
||||
### 0.11.15 (2016-09-13 19:50:00 UTC)
|
||||
|
||||
* Add rollback capability to undo database changes made during tests
|
||||
|
||||
|
|
|
@ -59,6 +59,12 @@ class ConsolidateProviders(InitialSchema):
|
|||
'indexerid NUMERIC, url TEXT UNIQUE, time NUMERIC, quality TEXT, release_group TEXT, '
|
||||
'version NUMERIC)')
|
||||
|
||||
if not self.hasTable('network_conversions'):
|
||||
self.connection.action('CREATE TABLE network_conversions ' +
|
||||
'(tvdb_network TEXT PRIMARY KEY, tvrage_network TEXT, tvrage_country TEXT)')
|
||||
self.connection.action('CREATE INDEX tvrage_idx ' +
|
||||
'on network_conversions (tvrage_network, tvrage_country)')
|
||||
|
||||
keep_tables = set(['lastUpdate', 'lastSearch', 'db_version', 'scene_exceptions', 'scene_names',
|
||||
'network_timezones', 'scene_exceptions_refresh', 'network_conversions', 'provider_cache'])
|
||||
current_tables = set(self.listTables())
|
||||
|
|
|
@ -977,6 +977,35 @@ class Migrate41(db.SchemaUpgrade):
|
|||
return self.checkDBVersion()
|
||||
|
||||
|
||||
# 43,44 -> 10001
|
||||
class Migrate43(db.SchemaUpgrade):
|
||||
def execute(self):
|
||||
db.backup_database('sickbeard.db', self.checkDBVersion())
|
||||
|
||||
db_chg = None
|
||||
table = 'tmdb_info'
|
||||
if self.hasTable(table):
|
||||
logger.log(u'Dropping redundant table tmdb_info')
|
||||
self.connection.action('DROP TABLE [%s]' % table)
|
||||
db_chg = True
|
||||
|
||||
if self.hasColumn('tv_shows', 'tmdb_id'):
|
||||
logger.log(u'Dropping redundant tmdb_info refs')
|
||||
self.dropColumn('tv_shows', 'tmdb_id')
|
||||
db_chg = True
|
||||
|
||||
if not self.hasTable('db_version'):
|
||||
self.connection.action('PRAGMA user_version = 0')
|
||||
self.connection.action('CREATE TABLE db_version (db_version INTEGER);')
|
||||
self.connection.action('INSERT INTO db_version (db_version) VALUES (0);')
|
||||
|
||||
if not db_chg:
|
||||
logger.log(u'Bumping database version')
|
||||
|
||||
self.setDBVersion(10001)
|
||||
return self.checkDBVersion()
|
||||
|
||||
|
||||
# 4301 -> 10002
|
||||
class Migrate4301(db.SchemaUpgrade):
|
||||
def execute(self):
|
||||
|
|
|
@ -66,11 +66,16 @@ class DBConnection(object):
|
|||
|
||||
def checkDBVersion(self):
|
||||
|
||||
result = None
|
||||
|
||||
try:
|
||||
if self.hasTable('db_version'):
|
||||
result = self.select('SELECT db_version FROM db_version')
|
||||
else:
|
||||
version = self.select('PRAGMA user_version')[0]['user_version']
|
||||
if version:
|
||||
self.action('PRAGMA user_version = 0')
|
||||
self.action('CREATE TABLE db_version (db_version INTEGER);')
|
||||
self.action('INSERT INTO db_version (db_version) VALUES (%s);' % version)
|
||||
return version
|
||||
except:
|
||||
return 0
|
||||
|
||||
|
@ -423,8 +428,8 @@ def MigrationCode(myDB):
|
|||
40: sickbeard.mainDB.BumpDatabaseVersion,
|
||||
41: sickbeard.mainDB.Migrate41,
|
||||
42: sickbeard.mainDB.Migrate41,
|
||||
43: sickbeard.mainDB.Migrate41,
|
||||
44: sickbeard.mainDB.Migrate41,
|
||||
43: sickbeard.mainDB.Migrate43,
|
||||
44: sickbeard.mainDB.Migrate43,
|
||||
|
||||
4301: sickbeard.mainDB.Migrate4301,
|
||||
4302: sickbeard.mainDB.Migrate4302,
|
||||
|
|
Loading…
Reference in a new issue