/*
Tags on a post
A post's tags are deleted if the post is deleted.
*/
/* dot -Tsvg
@name db/schema/tags
digraph tags {
tags [
	shape="plaintext"
	label=<<table>
		<tr><td colspan="3"><b>tags</b></td></tr>
		<tr>
			<td port="id">PK</td>
			<td>id</td>
			<td>INT, AUTOINCREMENT, NOT NULL</td>
		</tr>
		<tr>
			<td>FK</td>
			<td>postid</td>
			<td port="postid">ON DELETE CASCADE</td>
		</tr>
		<tr>
			<td></td>
			<td>tag</td>
			<td>TEXT</td>
		</tr>
	</table>>

];
posts [
	shape="plaintext"
	label=<<table>
		<tr><td colspan="3"><b>posts</b></td></tr>
		<tr>
			<td port="id">PK</td>
			<td>id</td>
			<td>INT, AUTOINCREMENT, NOT NULL</td>
		</tr>
		<tr><td colspan="3">...</td></tr>
	</table>>
];
	tags:postid -> posts:id
}
*/
CREATE TABLE IF NOT EXISTS tags (
	id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
	postid REFERENCES posts(id) ON DELETE CASCADE,
	tag TEXT
);
