26 lines
620 B
SQL
26 lines
620 B
SQL
/* md
|
|
@name sql/table/comments
|
|
Comments on a post.
|
|
|
|
When an author deletes their account or the posts this comment
|
|
is posted on is deleted, this comment will also be deleted.
|
|
*/
|
|
|
|
/* sh
|
|
@name sql/table/comments
|
|
echo "digraph comments{" \
|
|
"$(cat doc/schema/authors.dot)" \
|
|
"$(cat doc/schema/posts.dot)" \
|
|
"$(cat doc/schema/comments.dot)" \
|
|
"}" | dot -Tsvg
|
|
*/
|
|
CREATE TABLE IF NOT EXISTS comments (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
postid REFERENCES posts(id) ON DELETE CASCADE,
|
|
author REFERENCES authors(id) ON DELETE CASCADE,
|
|
isanon INTEGER,
|
|
comment_text TEXT,
|
|
hashedip BLOB,
|
|
post_time INTEGER
|
|
);
|