Permalink
Browse files

Fix the version check when no database exists

  • Loading branch information...
1 parent baa2068 commit c4767342d549859146e1cc97d5e8cbfd163b7c28 @midgetspy committed Mar 12, 2013
Showing with 11 additions and 3 deletions.
  1. +5 −2 SickBeard.py
  2. +6 −1 sickbeard/db.py
View
@@ -263,8 +263,11 @@ def main():
sickbeard.CFG = ConfigObj(sickbeard.CONFIG_FILE)
if db.DBConnection().checkDBVersion() > MAX_DB_VERSION:
- print 'Your database version has been incremented past what this version of Sick Beard supports.'
- print 'Have you used other forks of Sick Beard with this same database file?'
+ print 'Your database version has been incremented'
+ print 'past what this version of Sick Beard supports.'
+ print
+ print 'If you have used other forks of SB which have'
+ print 'modified your database it may now be unusable.'
sys.exit(1)
# Initialize the config and our threads
View
@@ -55,7 +55,12 @@ def __init__(self, filename="sickbeard.db", suffix=None, row_type=None):
self.connection.row_factory = sqlite3.Row
def checkDBVersion(self):
- result = self.select("SELECT db_version FROM db_version")
+ try:
+ result = self.select("SELECT db_version FROM db_version")
+ except sqlite3.OperationalError, e:
+ if "no such table: db_version" in e.message:
+ return 0
+
if result:
return int(result[0]["db_version"])
else:

0 comments on commit c476734

Please sign in to comment.