CREATE TABLE days (
    date TEXT PRIMARY KEY,
    comment TEXT NOT NULL
);
CREATE TABLE process_descriptions (
    process_id INTEGER NOT NULL,
    timestamp TEXT NOT NULL,
    description TEXT NOT NULL,
    PRIMARY KEY (process_id, timestamp),
    FOREIGN KEY (process_id) REFERENCES processes(id)
);
CREATE TABLE process_efforts (
    process_id INTEGER NOT NULL,
    timestamp TEXT NOT NULL,
    effort REAL NOT NULL,
    PRIMARY KEY (process_id, timestamp),
    FOREIGN KEY (process_id) REFERENCES processes(id)
);
CREATE TABLE process_steps (
    step_id INTEGER PRIMARY KEY,
    owner_id INTEGER NOT NULL,
    step_process_id INTEGER NOT NULL,
    parent_step_id INTEGER,
    FOREIGN KEY (owner_id) REFERENCES processes(id),
    FOREIGN KEY (step_process_id) REFERENCES processes(id),
    FOREIGN KEY (parent_step_id) REFERENCES process_steps(step_id)
);
CREATE TABLE process_titles (
    process_id INTEGER NOT NULL,
    timestamp TEXT NOT NULL,
    title TEXT NOT NULL,
    PRIMARY KEY (process_id, timestamp),
    FOREIGN KEY (process_id) REFERENCES processes(id)
);
CREATE TABLE processes (
    id INTEGER PRIMARY KEY
);
