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
1 changed files with 13 additions and 13 deletions

View File

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