diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d928908..f073bb24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,10 @@ * Fix: Libraries and Users lists not refreshing. * Fix: Server verification in settings. * Fix: Empty libraries not added to database. -* Add: Unique identifier to notification options. -* Remove: Media type toggles for recently added notifications. +* Add: Unique identifiers to notification options. +* Remove: Requirement of media type toggles for recently added notifications. * Remove: Built in Twitter key and secret. -* Remove: Unnecessary quoting of script arguments. +* Change: Unnecessary quoting of script arguments. * Change: Facebook notification instructions. diff --git a/plexpy/__init__.py b/plexpy/__init__.py index 6827df72..806833b6 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -713,8 +713,8 @@ def dbcheck(): # Upgrade library_sections table from earlier versions (remove UNIQUE constraint on section_id) try: - result = c_db.execute('PRAGMA index_xinfo("sqlite_autoindex_library_sections_1")') - if result and 'server_id' not in [row[2] for row in result]: + result = c_db.execute('SELECT SQL FROM sqlite_master WHERE type="table" AND name="library_sections"').fetchone() + if 'section_id INTEGER UNIQUE' in result[0]: logger.debug(u"Altering database. Removing unique constraint on section_id from library_sections table.") c_db.execute( 'CREATE TABLE library_sections_temp (id INTEGER PRIMARY KEY AUTOINCREMENT, ' @@ -760,8 +760,8 @@ def dbcheck(): # Upgrade users table from earlier versions (remove UNIQUE constraint on username) try: - result = c_db.execute('PRAGMA index_xinfo("sqlite_autoindex_users_2")') - if result and 'username' in [row[2] for row in result]: + result = c_db.execute('SELECT SQL FROM sqlite_master WHERE type="table" AND name="users"').fetchone() + if 'username TEXT NOT NULL UNIQUE' in result[0]: logger.debug(u"Altering database. Removing unique constraint on username from users table.") c_db.execute( 'CREATE TABLE users_temp (id INTEGER PRIMARY KEY AUTOINCREMENT, '