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
|
||||
|
||||
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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user