Add option to change the newsletter filename

This commit is contained in:
JonnyWong16 2018-05-07 20:02:04 -07:00
commit 19cf567366
5 changed files with 78 additions and 23 deletions

View file

@ -648,7 +648,7 @@ 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, success INTEGER DEFAULT 0)'
'start_time INTEGER, end_time INTEGER, uuid TEXT UNIQUE, filename TEXT, success INTEGER DEFAULT 0)'
)
# recently_added table :: This table keeps record of recently added items
@ -1495,6 +1495,15 @@ def dbcheck():
'ALTER TABLE newsletter_log ADD COLUMN end_time INTEGER'
)
# Upgrade newsletter_log table from earlier versions
try:
c_db.execute('SELECT filename 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 filename TEXT'
)
# Upgrade library_sections table from earlier versions (remove UNIQUE constraint on section_id)
try:
result = c_db.execute('SELECT SQL FROM sqlite_master WHERE type="table" AND name="library_sections"').fetchone()