intake/core/sql/0001_initial_schema.sql

62 lines
1.8 KiB
MySQL
Raw Normal View History

create table sources(
name text not null,
2025-01-30 23:22:57 +00:00
state blob,
primary key (name)
) strict;
2025-01-21 03:53:22 +00:00
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;
2025-01-31 15:50:56 +00:00
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;
2025-01-17 05:11:07 +00:00
create table items(
source text not null,
id text not null,
created int not null default (unixepoch()),
active int not null,
2025-02-10 16:26:15 +00:00
title text not null,
author text not null,
body text not null,
link text not null,
2025-01-17 05:11:07 +00:00
time int,
2025-02-05 06:56:26 +00:00
ttl int,
ttd int,
tts int,
2025-01-29 16:48:12 +00:00
action blob,
2025-01-17 05:11:07 +00:00
primary key (source, id),
foreign key (source) references sources (name) on delete cascade
) strict;
2025-02-01 01:23:41 +00:00
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
2025-02-02 08:20:51 +00:00
) strict;
create table password(
id int not null,
2025-02-10 16:26:15 +00:00
hash text not null,
2025-02-02 08:20:51 +00:00
unique (id) on conflict replace
) strict;
2025-02-06 14:33:39 +00:00
create table sessions(
id text not null,
expires int default 0,
primary key (id)
) strict;
2025-02-10 16:26:15 +00:00
-- 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'))