entretien/migrations/each_user/0001_task-tables.sql

28 lines
748 B
MySQL
Raw Normal View History

create table if not exists frequencies (
id integer primary key autoincrement,
description text not null default ''
);
insert into frequencies (id, description) values
(1, 'daily'),
(2, 'weekly'),
(3, 'fortnightly'),
(4, 'monthly'),
(5, 'seasonally'),
(6, 'semiannually'),
(7, 'yearly')
on conflict (id) do update set description=excluded.description;
create table if not exists tasks (
id integer primary key autoincrement,
description text not null default '',
frequency_id integer not null references frequencies(id) on delete cascade
);
create table if not exists completions (
id integer primary key autoincrement,
task_id integer not null references tasks(id) on delete cascade,
datestamp text not null
);