aboutsummaryrefslogtreecommitdiffstats
path: root/migrations/1.sql
blob: e540cac126adccfe9c5e80f6f1d1b866f99ca575 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
PRAGMA foreign_keys = on;

create table tasks (
    id blob primary key,
    name text unique not null,
    -- TODO: multiple crons?
    cron text,
    archived integer not null default 0,
    description text
);

create table categories (
    id blob primary key,
    name text unique not null
);

create table tasks_categories (
    task_id blob not null,
    category_id blob not null,
    foreign key(task_id) references tasks(id) on delete cascade,
    foreign key(category_id) references categories(id) on delete cascade
);

create table log (
    id blob primary key,
    task_id blob not null,
    timestamp text not null,
    foreign key(task_id) references tasks(id) on delete cascade
);

create table reminders (
    id blob primary key,
    task_id blob not null,
    time_delta text not null,
    foreign key(task_id) references tasks(id) on delete cascade
);