Set on_created notification in database

This commit is contained in:
Jonathan Wong 2015-10-25 12:20:00 -07:00
parent 539cd60e92
commit d6b31dc542
3 changed files with 63 additions and 24 deletions

View file

@ -552,7 +552,7 @@ def dbcheck():
'CREATE TABLE IF NOT EXISTS notify_log (id INTEGER PRIMARY KEY AUTOINCREMENT, '
'session_key INTEGER, rating_key INTEGER, user_id INTEGER, user TEXT, '
'agent_id INTEGER, agent_name TEXT, on_play INTEGER, on_stop INTEGER, on_watched INTEGER, '
'on_pause INTEGER, on_resume INTEGER, on_buffer INTEGER)'
'on_pause INTEGER, on_resume INTEGER, on_buffer INTEGER, on_created INTEGER)'
)
# Upgrade users table from earlier versions
@ -588,6 +588,15 @@ def dbcheck():
'ALTER TABLE notify_log ADD COLUMN on_buffer INTEGER'
)
# Upgrade notify_log table from earlier versions
try:
c_db.execute('SELECT on_created from notify_log')
except sqlite3.OperationalError:
logger.debug(u"Altering database. Updating database table notify_log.")
c_db.execute(
'ALTER TABLE notify_log ADD COLUMN on_created INTEGER'
)
# Upgrade sessions table from earlier versions
try:
c_db.execute('SELECT buffer_count from sessions')