DROP TABLE IF EXISTS `oppy_category`;
CREATE TABLE IF NOT EXISTS `oppy_category` (
  `id` SMALLINT(6) UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(100) NOT NULL DEFAULT '',
  `num` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `name` (`name`),
  KEY `num` (`num`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `oppy_post`;
CREATE TABLE IF NOT EXISTS `oppy_post` (
  `id` MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
  `cid` SMALLINT(6) NOT NULL DEFAULT '1',
  `views` INT(10) UNSIGNED NOT NULL DEFAULT '1',
  `title` VARCHAR(100) NOT NULL DEFAULT '',
  `markdown` MEDIUMTEXT NOT NULL,
  `html` MEDIUMTEXT NOT NULL,
  `tags` VARCHAR(100) NOT NULL,
  `add_time` INT(10) UNSIGNED NOT NULL DEFAULT '0',
  `edit_time` INT(10) UNSIGNED NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `cid` (`cid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `oppy_tag`;
CREATE TABLE IF NOT EXISTS `oppy_tag` (
  `id` SMALLINT(6) UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(20) NOT NULL DEFAULT '',
  `num` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
  `content` MEDIUMTEXT NOT NULL,
  PRIMARY KEY (`id`),
  KEY `name` (`name`),
  KEY `num` (`num`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

DROP TABLE IF EXISTS `oppy_user`;
CREATE TABLE IF NOT EXISTS `oppy_user` (
  `id` SMALLINT(6) UNSIGNED NOT NULL AUTO_INCREMENT,
  `flag` TINYINT(1) NOT NULL DEFAULT '5',
  `name` VARCHAR(20) NOT NULL DEFAULT '',
  `password` VARCHAR(32) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`),
  KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
