intake/core/sql/0001_initial_schema.sql

48 lines
1.2 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,
primary key (source, name),
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,
author text,
body text,
link text,
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,
unique (id) on conflict replace
) strict;