2024-03-18 23:07:48 -07:00
|
|
|
create table user (
|
|
|
|
id integer primary key asc,
|
|
|
|
name text,
|
|
|
|
created timestamp default current_timestamp
|
2023-05-05 19:33:05 -07:00
|
|
|
);
|
|
|
|
|
2024-04-28 22:55:54 -07:00
|
|
|
create table key (
|
2024-03-18 23:07:48 -07:00
|
|
|
user integer,
|
2024-04-28 22:55:54 -07:00
|
|
|
pubkey text,
|
2024-03-18 23:07:48 -07:00
|
|
|
created timestamp default current_timestamp,
|
2024-04-28 22:55:54 -07:00
|
|
|
active boolean,
|
2024-03-18 23:07:48 -07:00
|
|
|
foreign key(user) references user(id)
|
2023-05-07 18:43:57 -07:00
|
|
|
);
|
|
|
|
|
2024-03-18 23:07:48 -07:00
|
|
|
create table thread (
|
|
|
|
id integer primary key asc,
|
|
|
|
name text,
|
|
|
|
creator integer,
|
|
|
|
created timestamp default current_timestamp,
|
|
|
|
foreign key(creator) references user(id)
|
2023-05-05 19:33:05 -07:00
|
|
|
);
|
|
|
|
|
2024-03-18 23:07:48 -07:00
|
|
|
create table permission (
|
|
|
|
thread integer,
|
|
|
|
user integer,
|
|
|
|
type text,
|
|
|
|
mutable boolean,
|
|
|
|
permission text,
|
|
|
|
value text,
|
|
|
|
foreign key(user) references user(id),
|
|
|
|
foreign key(thread) references thread(id)
|
2023-05-28 14:56:08 -07:00
|
|
|
);
|
2023-05-09 00:04:48 -07:00
|
|
|
|
2024-03-18 23:07:48 -07:00
|
|
|
create table member (
|
|
|
|
thread integer,
|
|
|
|
user integer,
|
|
|
|
created timestamp default current_timestamp,
|
|
|
|
foreign key(user) references user(id),
|
|
|
|
foreign key(thread) references thread(id)
|
2023-05-28 14:56:08 -07:00
|
|
|
);
|
2023-05-09 00:04:48 -07:00
|
|
|
|
2024-03-18 23:07:48 -07:00
|
|
|
create table post (
|
|
|
|
id integer primary key asc,
|
|
|
|
user integer,
|
|
|
|
thread integer,
|
|
|
|
content text,
|
|
|
|
encrypted bool,
|
|
|
|
created timestamp default current_timestamp,
|
|
|
|
foreign key(user) references user(id),
|
|
|
|
foreign key(thread) references thread(id)
|
2023-05-05 19:33:05 -07:00
|
|
|
);
|
|
|
|
|
2024-03-18 23:07:48 -07:00
|
|
|
create table span (
|
|
|
|
id integer primary key asc,
|
|
|
|
thread integer,
|
2024-04-15 14:27:21 -07:00
|
|
|
deleted bool default false,
|
2024-03-18 23:07:48 -07:00
|
|
|
content text,
|
2024-04-15 14:27:21 -07:00
|
|
|
x decimal,
|
|
|
|
y decimal,
|
2024-03-18 23:07:48 -07:00
|
|
|
scale decimal,
|
|
|
|
foreign key(thread) references thread(id)
|
|
|
|
);
|
|
|
|
|
|
|
|
insert into thread (name) values ("meow");
|
|
|
|
insert into permission
|
|
|
|
(thread, type, permission, value) values
|
|
|
|
(1, "everyone", "view", "true");
|
|
|
|
insert into permission
|
|
|
|
(thread, type, permission, value) values
|
2024-04-15 14:27:21 -07:00
|
|
|
(1, "everyone", "post", "true");
|