vybe/db/1-init.sql

60 lines
1.1 KiB
SQL

create table user (
id integer primary key asc,
name text,
displayname text,
created timestamp default current_timestamp
);
create table key (
user integer,
pubkey text,
created timestamp default current_timestamp,
active boolean,
foreign key(user) references user(id)
);
create table thread (
id integer primary key asc,
name text,
creator text,
created timestamp default current_timestamp
);
create table permission (
thread integer,
user text,
type text,
mutable boolean,
permission text,
value text,
foreign key(thread) references thread(id)
);
create table member (
thread integer,
user text,
created timestamp default current_timestamp,
foreign key(thread) references thread(id)
);
create table post (
id integer primary key asc,
user text,
thread integer,
content text,
encrypted bool,
created timestamp default current_timestamp,
foreign key(thread) references thread(id)
);
create table span (
id integer primary key asc,
thread integer,
deleted bool default false,
content text,
x decimal,
y decimal,
scale decimal,
foreign key(thread) references thread(id)
);