smr/src/sql/create_table_session.sql

22 lines
597 B
MySQL
Raw Normal View History

/* md
@name sql/table/sessions
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.
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.
*/
/* sh
@name sql/table/sessions
echo "digraph comments{" \
"$(cat doc/schema/sessions.dot)" \
"$(cat doc/schema/authors.dot)" \
"}" | dot -Tsvg
*/
CREATE TABLE IF NOT EXISTS sessions (
key TEXT PRIMARY KEY,
author REFERENCES authors(id) ON DELETE CASCADE,
start INTEGER
);