demos for spacedust
1create table if not exists accounts (
2 did text primary key,
3 first_seen text not null default CURRENT_TIMESTAMP,
4 role text null,
5 secret_password text null,
6 notify_enabled integer not null default false,
7 notify_self integer not null default false,
8
9 check(did like 'did:%')
10) strict;
11
12create table if not exists push_subs (
13 session text primary key, -- uuidv4, bound to signed browser cookie
14 account_did text not null,
15 subscription text not null, -- from browser, treat as opaque blob
16
17 created text not null default CURRENT_TIMESTAMP,
18
19 last_push text,
20 total_pushes integer not null default 0,
21
22 foreign key(account_did) references accounts(did)
23 on delete cascade on update cascade
24) strict;
25
26create table if not exists top_secret_passwords (
27 password text primary key,
28 added text not null default CURRENT_TIMESTAMP,
29 expired text null, -- timestamp
30
31 check(length(password) >= 3)
32) strict;
33
34create table if not exists notification_filters (
35 account_did text not null,
36 selector text not null,
37 selection text not null,
38 notify integer null,
39
40 primary key(account_did, selector, selection),
41 check(selector in ('all', 'app', 'group', 'source')),
42
43 foreign key(account_did) references accounts(did)
44 on delete cascade on update cascade
45) strict;