

CREATE TABLE IF NOT EXISTS `comments` (
	`id` int(6) NOT NULL AUTO_INCREMENT,
	`post` int(6) NOT NULL,
	`status` enum('pending','published','spam') NOT NULL,
	`date` int(11) NOT NULL,
	`name` varchar(140) NOT NULL,
	`email` varchar(140) NOT NULL,
	`text` text NOT NULL,
	PRIMARY KEY (`id`),
	KEY `post` (`post`),
	KEY `status` (`status`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;


CREATE TABLE `pages` (
	`id` int(6) NOT NULL AUTO_INCREMENT,
	`slug` varchar(150) NOT NULL,
	`name` varchar(64) NOT NULL,
	`title` varchar(150) NOT NULL,
	`content` text NOT NULL,
	`status` enum('draft','published','archived') NOT NULL,
	PRIMARY KEY (`id`),
	KEY `status` (`status`),
	KEY `slug` (`slug`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;

INSERT INTO `pages` (`slug`, `name`, `title`, `content`, `status`) VALUES
('posts', 'Posts', 'My posts and thoughts', '<p>Welcome!</p>', 'published'),
('about', 'About', 'A little bit about me', '<p>This is a little bit of text about me.</p>', 'published');


CREATE TABLE `posts` (
	`id` int(6) NOT NULL AUTO_INCREMENT,
	`title` varchar(150) NOT NULL,
	`slug` varchar(150) NOT NULL,
	`description` text NOT NULL,
	`html` text NOT NULL,
	`css` text NOT NULL,
	`js` text NOT NULL,
	`custom_fields` text,
	`created` int(11) NOT NULL,
	`author` int(6) NOT NULL,
	`status` enum('draft','published','archived') NOT NULL,
	`comments` TINYINT( 1 ) NOT NULL,
	PRIMARY KEY (`id`),
	KEY `status` (`status`),
	KEY `slug` (`slug`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;

INSERT INTO `posts` (`title`, `slug`, `description`, `html`, `css`, `js`, `created`, `author`, `status`, `comments`) VALUES
('Hello World', 'hello', 'Hello World.', '<p>My first post.</p>', '', '', '[[now]]', 1, 'published', 1);


CREATE TABLE IF NOT EXISTS `sessions` (
	`id` CHAR( 32 ) NOT NULL ,
	`date` DATETIME NOT NULL ,
	`ip` VARCHAR( 15 ) NOT NULL ,
	`ua` TEXT NOT NULL ,
	`data` TEXT NOT NULL
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
