/* md
@name sql/table/posts
If/when an author delets their account, all posts
and comments by that author are also deleted (on
delete cascade) this is intentional. This also
means that all comments by other users on a post
an author makes will also be deleted.

Post text uses zlib compression

Unlisted hashes are SHAv3 521
*/

/* sh
@name sql/table/posts
echo "digraph comments{" \
	"$(cat doc/schema/authors.dot)" \
	"$(cat doc/schema/posts.dot)" \
	"}" | dot -Tsvg
*/
CREATE TABLE IF NOT EXISTS posts (
	id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
	post_text BLOB,
	post_title TEXT,
	authorid REFERENCES authors(id) ON DELETE CASCADE,
	isanon INTEGER,
	hashedip BLOB,
	post_time INTEGER,
	views INTEGER DEFAULT 0,
	unlisted INTEGER,
	hash BLOB 
);
