Add option for threaded newsletter emails

This commit is contained in:
JonnyWong16 2018-07-29 10:28:34 -07:00
commit 0821c14aae
5 changed files with 66 additions and 10 deletions

View file

@ -668,7 +668,8 @@ def dbcheck():
'CREATE TABLE IF NOT EXISTS newsletter_log (id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp INTEGER, '
'newsletter_id INTEGER, agent_id INTEGER, agent_name TEXT, notify_action TEXT, '
'subject_text TEXT, body_text TEXT, message_text TEXT, start_date TEXT, end_date TEXT, '
'start_time INTEGER, end_time INTEGER, uuid TEXT UNIQUE, filename TEXT, success INTEGER DEFAULT 0)'
'start_time INTEGER, end_time INTEGER, uuid TEXT UNIQUE, filename TEXT, email_msg_id TEXT, '
'success INTEGER DEFAULT 0)'
)
# recently_added table :: This table keeps record of recently added items
@ -1563,6 +1564,15 @@ def dbcheck():
'ALTER TABLE newsletter_log ADD COLUMN filename TEXT'
)
# Upgrade newsletter_log table from earlier versions
try:
c_db.execute('SELECT email_msg_id FROM newsletter_log')
except sqlite3.OperationalError:
logger.debug(u"Altering database. Updating database table newsletter_log.")
c_db.execute(
'ALTER TABLE newsletter_log ADD COLUMN email_msg_id TEXT'
)
# Upgrade newsletters table from earlier versions
try:
c_db.execute('SELECT id_name FROM newsletters')