summaryrefslogtreecommitdiff
path: root/fracture/db.py
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2020-08-06 16:13:55 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2020-08-06 16:13:55 +0200
commit935690c57824b7422f6b128fb1355f95c8111b86 (patch)
tree202db4f0ec579c2051f95892f1f503dbbd69fc2f /fracture/db.py
parenta4927a2a306253035dd4980943c97440e208191e (diff)
Invoice rendering:
- load by id-repr to be able to choose correctly - render to json or to dict
Diffstat (limited to 'fracture/db.py')
-rw-r--r--fracture/db.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/fracture/db.py b/fracture/db.py
index 56a268d..1e90727 100644
--- a/fracture/db.py
+++ b/fracture/db.py
@@ -24,6 +24,7 @@ def create(dbname):
# date is %Y-%m-%d
c.execute('''CREATE TABLE invoices
( id INTEGER NOT NULL,
+ id_repr TEXT NOT NULL,
type TEXT NOT NULL,
series INTEGER NOT NULL,
date TEXT NOT NULL,
@@ -32,7 +33,8 @@ def create(dbname):
customer_id TEXT,
customer_name TEXT,
customer_address TEXT,
- PRIMARY KEY(type, series, id)
+ PRIMARY KEY(type, series, id),
+ UNIQUE (id_repr, type)
)''')
c.execute('''CREATE TABLE taxes