From e0a85e23915b603d1fb9f979237d76a1cf0ce28a Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sun, 16 May 2021 15:47:12 -0700 Subject: [PATCH] Add tag to notify_log database table --- plexpy/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plexpy/__init__.py b/plexpy/__init__.py index bf47f57b..8a5abf38 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -758,7 +758,7 @@ def dbcheck(): 'CREATE TABLE IF NOT EXISTS notify_log (id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp INTEGER, ' 'session_key INTEGER, rating_key INTEGER, parent_rating_key INTEGER, grandparent_rating_key INTEGER, ' 'user_id INTEGER, user TEXT, notifier_id INTEGER, agent_id INTEGER, agent_name TEXT, notify_action TEXT, ' - 'subject_text TEXT, body_text TEXT, script_args TEXT, success INTEGER DEFAULT 0)' + 'subject_text TEXT, body_text TEXT, script_args TEXT, success INTEGER DEFAULT 0, tag TEXT)' ) # newsletters table :: This table keeps record of the newsletter settings @@ -1964,6 +1964,15 @@ def dbcheck(): 'UPDATE notify_log SET success = 1' ) + # Upgrade notify_log table from earlier versions + try: + c_db.execute('SELECT tag FROM notify_log') + except sqlite3.OperationalError: + logger.debug("Altering database. Updating database table notify_log.") + c_db.execute( + 'ALTER TABLE notify_log ADD COLUMN tag TEXT' + ) + # Upgrade newsletter_log table from earlier versions try: c_db.execute('SELECT start_time FROM newsletter_log')