62 lines
1.9 KiB
SQL
62 lines
1.9 KiB
SQL
create table sources(
|
|
name text not null,
|
|
state blob,
|
|
primary key (name)
|
|
) strict;
|
|
create table actions(
|
|
source text not null,
|
|
name text not null,
|
|
argv blob not null,
|
|
unique (source, name) on conflict replace,
|
|
foreign key (source) references sources (name) on delete cascade
|
|
) strict;
|
|
create table envs(
|
|
source text not null,
|
|
name text not null,
|
|
value text not null,
|
|
unique (source, name) on conflict replace,
|
|
foreign key (source) references sources (name) on delete cascade
|
|
) strict;
|
|
create table items(
|
|
source text not null,
|
|
id text not null,
|
|
created int not null default (unixepoch()),
|
|
active int not null,
|
|
title text not null,
|
|
author text not null,
|
|
body text not null,
|
|
link text not null,
|
|
time int,
|
|
ttl int,
|
|
ttd int,
|
|
tts int,
|
|
action blob,
|
|
primary key (source, id),
|
|
foreign key (source) references sources (name) on delete cascade
|
|
) strict;
|
|
create table channels(
|
|
name text not null,
|
|
source text not null,
|
|
unique (name, source) on conflict replace
|
|
foreign key (source) references sources (name) on delete cascade
|
|
) strict;
|
|
create table password(
|
|
id int not null,
|
|
hash text not null,
|
|
unique (id) on conflict replace
|
|
) strict;
|
|
create table sessions(
|
|
id text not null,
|
|
expires int default 0,
|
|
primary key (id)
|
|
) strict;
|
|
|
|
-- user introduction
|
|
-- insert into sources (name) values ('default');
|
|
-- insert into channels (name, source) values ('home', 'default');
|
|
-- insert into actions (source, name, argv) values ('default', 'fetch', jsonb('["true"]'));
|
|
-- insert into items (source, id, active, title, author, body, link, time, ttl, ttd, tts, action)
|
|
-- values ('default', 'welcome', 1, 'Welcome to intake!', 'intake',
|
|
-- '<p>Click the "X" button on this item to deactivate it and hide it from the feed.</p>',
|
|
-- '', 1, 0, 0, 0, jsonb('null'))
|