updated database schema again for dates and hours
This commit is contained in:
parent
78cb101357
commit
684834806e
14
DataStore.py
14
DataStore.py
@ -3,10 +3,10 @@ import sqlite3
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
class DataStore:
|
class DataStore:
|
||||||
def __init__(self, timedbfile):
|
def __init__(self, dbfile):
|
||||||
if not os.path.exists(timedbfile):
|
if not os.path.exists(dbfile):
|
||||||
self.createdb(timedbfile)
|
self.createdb(dbfile)
|
||||||
self.conn = sqlite3.connect(timedbfile)
|
self.conn = sqlite3.connect(dbfile)
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.conn.close()
|
self.conn.close()
|
||||||
@ -24,15 +24,17 @@ CREATE TABLE tasks (
|
|||||||
)''')
|
)''')
|
||||||
c.execute('''
|
c.execute('''
|
||||||
CREATE TABLE entries (
|
CREATE TABLE entries (
|
||||||
date INTEGER PRIMARY KEY,
|
date TEXT,
|
||||||
taskid INTEGER,
|
taskid INTEGER,
|
||||||
hours REAL,
|
seconds INTEGER,
|
||||||
|
PRIMARY KEY (date, taskid),
|
||||||
FOREIGN KEY (taskid) REFERENCES tasks(id)
|
FOREIGN KEY (taskid) REFERENCES tasks(id)
|
||||||
)''')
|
)''')
|
||||||
c.execute('''
|
c.execute('''
|
||||||
CREATE TABLE history (
|
CREATE TABLE history (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
taskid INTEGER,
|
taskid INTEGER,
|
||||||
|
datetime TEXT,
|
||||||
FOREIGN KEY (taskid) REFERENCES tasks(id)
|
FOREIGN KEY (taskid) REFERENCES tasks(id)
|
||||||
)''')
|
)''')
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user