diff --git a/DataStore.py b/DataStore.py index fd20af1..f3f05e2 100644 --- a/DataStore.py +++ b/DataStore.py @@ -3,10 +3,10 @@ import sqlite3 import os class DataStore: - def __init__(self, timedbfile): - if not os.path.exists(timedbfile): - self.createdb(timedbfile) - self.conn = sqlite3.connect(timedbfile) + def __init__(self, dbfile): + if not os.path.exists(dbfile): + self.createdb(dbfile) + self.conn = sqlite3.connect(dbfile) def __del__(self): self.conn.close() @@ -24,15 +24,17 @@ CREATE TABLE tasks ( )''') c.execute(''' CREATE TABLE entries ( - date INTEGER PRIMARY KEY, + date TEXT, taskid INTEGER, - hours REAL, + seconds INTEGER, + PRIMARY KEY (date, taskid), FOREIGN KEY (taskid) REFERENCES tasks(id) )''') c.execute(''' CREATE TABLE history ( id INTEGER PRIMARY KEY, taskid INTEGER, + datetime TEXT, FOREIGN KEY (taskid) REFERENCES tasks(id) )''') conn.commit()