forked from tildetown/bbj2
Compare commits
1 Commits
wip/refact
...
trunk
Author | SHA1 | Date |
---|---|---|
vilmibm | afd9c3c070 |
|
@ -0,0 +1,52 @@
|
|||
create table meta (
|
||||
version text -- schema version
|
||||
);
|
||||
|
||||
insert into meta values ("1.0.0");
|
||||
|
||||
create table users (
|
||||
user_id text, -- string (uuid1)
|
||||
user_name text, -- string
|
||||
auth_hash text, -- string (sha256 hash)
|
||||
quip text, -- string (possibly empty)
|
||||
bio text, -- string (possibly empty)
|
||||
color int, -- int (from 0 to 6)
|
||||
is_admin int, -- bool
|
||||
created real -- floating point unix timestamp (when this user registered)
|
||||
);
|
||||
|
||||
insert into users values (
|
||||
"be105a40-6bd1-405f-9716-aa6158ac1eef", -- TODO replace UUID with incrementing int
|
||||
"anon",
|
||||
"8e97c0b197816a652fb489b21e63f664863daa991e2f8fd56e2df71593c2793f",
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
0,
|
||||
1650819851
|
||||
);
|
||||
|
||||
-- TODO unique constraint on user_name?
|
||||
-- TODO foreign keys
|
||||
|
||||
create table threads (
|
||||
thread_id text, -- uuid string
|
||||
author text, -- string (uuid1, user.user_id)
|
||||
title text, -- string
|
||||
last_mod real, -- floating point unix timestamp (of last post or post edit)
|
||||
created real, -- floating point unix timestamp (when thread was made)
|
||||
reply_count int, -- integer (incremental, starting with 0)
|
||||
pinned int, -- boolean
|
||||
last_author text -- uuid string
|
||||
);
|
||||
|
||||
|
||||
create table messages (
|
||||
thread_id text, -- string (uuid1 of parent thread)
|
||||
post_id int, -- integer (incrementing from 1)
|
||||
author text, -- string (uuid1, user.user_id)
|
||||
created real, -- floating point unix timestamp (when reply was posted)
|
||||
edited int, -- bool
|
||||
body text, -- string
|
||||
send_raw int -- bool (1/true == never apply formatting)
|
||||
);
|
Loading…
Reference in New Issue