2023-08-10 00:28:48 +02:00
|
|
|
/* md
|
|
|
|
@name sql/table/sessions
|
2020-12-20 09:16:23 +01:00
|
|
|
Store a cookie for logged in users. Logged in users can edit
|
2023-05-17 23:18:24 +02:00
|
|
|
their own posts, edit their biographies, and post stories and comment under their own name.
|
2023-08-10 00:28:48 +02:00
|
|
|
TODO: We can hash the "key" so that even if the database gets
|
2023-05-17 23:18:24 +02:00
|
|
|
dumped, a hacker can't cookie-steal with only read access
|
|
|
|
to the db.
|
2020-12-20 09:16:23 +01:00
|
|
|
*/
|
2023-08-10 00:28:48 +02:00
|
|
|
|
|
|
|
/* sh
|
|
|
|
@name sql/table/sessions
|
|
|
|
echo "digraph comments{" \
|
|
|
|
"$(cat doc/schema/sessions.dot)" \
|
|
|
|
"$(cat doc/schema/authors.dot)" \
|
|
|
|
"}" | dot -Tsvg
|
|
|
|
*/
|
2020-05-17 18:05:00 +02:00
|
|
|
CREATE TABLE IF NOT EXISTS sessions (
|
|
|
|
key TEXT PRIMARY KEY,
|
|
|
|
author REFERENCES authors(id) ON DELETE CASCADE,
|
|
|
|
start INTEGER
|
|
|
|
);
|