Fix table construction to closely mimic loop

This commit is contained in:
Marty Oehme 2021-08-27 23:33:52 +02:00
parent d33c6a232e
commit 270635a17e
Signed by: Marty
GPG key ID: B7538B8F50A1C800

View file

@ -25,32 +25,32 @@ def create_tables(db):
c = db.cursor()
c.execute(
""" CREATE TABLE IF NOT EXISTS Habits (
id integer PRIMARY KEY,
id integer PRIMARY KEY AUTOINCREMENT,
archived integer,
color integer,
description text,
freq_den integer,
freq_num integer,
highlight integer,
name text NOT NULL,
position integer UNIQUE,
name text,
position integer,
reminder_hour integer,
reminder_min integer,
reminder_days integer,
type integer,
target_type integer,
target_value real,
unit text,
reminder_days integer NOT NULL DEFAULT 127,
type integer NOT NULL DEFAULT 0,
target_type integer NOT NULL DEFAULT 0,
target_value real NOT NULL DEFAULT 0,
unit text NOT NULL DEFAULT "",
question text,
uuid text NOT NULL
uuid text
); """
)
c.execute(
""" CREATE TABLE IF NOT EXISTS Repetitions (
id integer PRIMARY KEY,
habit integer,
timestamp integer,
value integer
id integer PRIMARY KEY AUTOINCREMENT,
habit integer NOT NULL REFERENCES Habits(id),
timestamp integer NOT NULL,
value integer NOT NULL
); """
)