summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
Diffstat (limited to 'storage')
-rw-r--r--storage/sqlite.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/storage/sqlite.py b/storage/sqlite.py
index 7a8e1d8..8c97186 100644
--- a/storage/sqlite.py
+++ b/storage/sqlite.py
@@ -6,7 +6,7 @@ from item import item
from pysqlite2 import dbapi2 as sqliteBackend
class sqlite(storageBase):
- dbVersion = '0.4'
+ dbVersion = '0.5'
def __init__(self):
self.con = sqliteBackend.connect(self.getConfigDir() + '/data.sqlite')
@@ -36,7 +36,8 @@ class sqlite(storageBase):
priority INTEGER,
desc BLOB,
completed INTEGER(1) DEFAULT (0),
- removed INTEGER(1) DEFAULT (0)
+ removed INTEGER(1) DEFAULT (0),
+ add due INTEGER DEFAULT (0)
)''')
self.cur.execute('drop table if exists control')
@@ -69,6 +70,12 @@ class sqlite(storageBase):
self.con.commit()
updateFrom = ('0.4',)
+ if updateFrom == ('0.4',):
+ self.cur.execute('''alter table todo
+ add due INTEGER DEFAULT (0)''')
+ self.con.commit()
+ updateFrom = ('0.5',)
+
self.cur.execute("update control set value = ? where setting = 'db-version'", updateFrom)
self.con.commit()
@@ -85,13 +92,13 @@ class sqlite(storageBase):
def notifyChange(self, sender):
if sender.getId() >= 0:
- self.cur.execute('update todo set title=?, createdAt=?, priority=?, desc=?, completed=?, removed=? where id=?',
+ self.cur.execute('update todo set title=?, createdAt=?, priority=?, desc=?, completed=?, removed=?, due=? where id=?',
(sender.getTitle(), sender.getCreatedAt(), sender.getPriority(),
- sender.getDescription(), sender.getCompleted(), sender.getRemoved(), sender.getId()))
+ sender.getDescription(), sender.getCompleted(), sender.getRemoved(), sender.getDue(), sender.getId()))
self.con.commit()
else:
- self.cur.execute('insert into todo (title, createdAt, priority, desc, completed, removed) VALUES (?, ?, ?, ?, ?, ?)',
+ self.cur.execute('insert into todo (title, createdAt, priority, desc, completed, removed, due) VALUES (?, ?, ?, ?, ?, ?, ?)',
(sender.getTitle(), sender.getCreatedAt(), sender.getPriority(),
- sender.getDescription(), sender.getCompleted(), sender.getRemoved()))
+ sender.getDescription(), sender.getCompleted(), sender.getRemoved(), sender.getDue()))
self.con.commit()
sender.setId(self.cur.execute('select last_insert_rowid()').fetchone()[0])