smr/src/sql/create_table_session.sql

22 lines
597 B
SQL

/* md
@name sql/table/sessions
Store a cookie for logged in users. Logged in users can edit
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
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
);