
CREATE DATABASE dragon_fire;

USE dragon_fire;

CREATE TABLE posts (
	post_id INTEGER AUTO_INCREMENT,

	post_path VARCHAR(255) NOT NULL,
	post_path_depth INTEGER NOT NULL DEFAULT 0,

	post_title TEXT,
	post_description TEXT,
	post_brief TEXT,

	post_content MEDIUMTEXT,
	post_content_type TEXT,

	PRIMARY KEY(post_id),
	CONSTRAINT unique_post_path UNIQUE (post_path),

	INDEX(post_path),
	INDEX(post_path_depth, post_path)
);

CREATE TABLE post_tags (
	post_id INTEGER,
	tag VARCHAR(255),

	CONSTRAINT post_fkey 
		FOREIGN KEY(post_id) REFERENCES posts(post_id)
		ON DELETE CASCADE,

	INDEX(post_id),
	INDEX(tag)
);


INSERT INTO posts (post_path, post_title, post_content)
VALUES (
	'/about',
	'About the Dergs',
'
# About the dergs indeed

This is just a simple test. Might be nice, though!
'
);