DROP TABLE IF EXISTS `k_action`;

CREATE TABLE `k_action` (
  `actionid` int(11) NOT NULL AUTO_INCREMENT,
  `actionname` varchar(50) DEFAULT NULL COMMENT '动作名称',
  `columnid` int(11) DEFAULT NULL COMMENT '动作分栏号(映射到actioncolumn表)',
  `unique` varchar(20) DEFAULT NULL,
  `url` varchar(50) DEFAULT NULL COMMENT '动作字符串',
  `viewmode` tinyint(4) DEFAULT '0' COMMENT '是否可见',
  `topshow` tinyint(4) DEFAULT '0',
  `rank` tinyint(4) DEFAULT '1',
  PRIMARY KEY (`actionid`),
  UNIQUE KEY `actionunique` (`unique`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_actioncolumn`;

CREATE TABLE `k_actioncolumn` (
  `columnid` int(11) NOT NULL AUTO_INCREMENT,
  `columnname` varchar(50) DEFAULT NULL COMMENT '动作分栏名称',
  `columnrank` smallint(6) DEFAULT '1',
  `columnshow` tinyint(4) DEFAULT '1',
  PRIMARY KEY (`columnid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_actionrole`;

CREATE TABLE `k_actionrole` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `actionid` int(11) DEFAULT NULL COMMENT '动作名称(映射到action表)',
  `roleid` int(11) DEFAULT NULL COMMENT '动作所属组ID(映射到mastergroup)',
  `masterid` int(11) DEFAULT NULL COMMENT '创建者id',
  `mastername` varchar(50) DEFAULT NULL COMMENT '创建者名称',
  `createdate` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_ads`;

CREATE TABLE `k_ads` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `text` text,
  `url` varchar(300) DEFAULT NULL,
  `group` varchar(50) DEFAULT NULL,
  `pic` varchar(300) DEFAULT NULL,
  `is_show` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk;

DROP TABLE IF EXISTS `k_arctype`;

CREATE TABLE `k_arctype` (
  `id` smallint(5) NOT NULL AUTO_INCREMENT,
  `fid` smallint(5) DEFAULT '0',
  `topid` smallint(6) DEFAULT '0',
  `typename` char(200) DEFAULT NULL,
  `shortname` varchar(200) DEFAULT NULL,
  `typedir` varchar(100) DEFAULT NULL,
  `jumpurl` varchar(120) DEFAULT NULL,
  `keywords` varchar(60) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `sortrank` smallint(50) DEFAULT '0',
  `sitepath` varchar(60) DEFAULT NULL,
  `listtpl` char(20) DEFAULT NULL,
  `viewtpl` char(20) DEFAULT NULL,
  `listrule` varchar(50) DEFAULT '',
  `viewrule` varchar(50) DEFAULT '',
  `litpic` varchar(100) DEFAULT NULL,
  `singlepage` tinyint(1) DEFAULT '0',
  `isshow` tinyint(4) DEFAULT '1',
  `con` text,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_article`;

CREATE TABLE `k_article` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `typeid` int(8) DEFAULT '0',
  `uid` int(11) DEFAULT '1',
  `title` varchar(250) DEFAULT NULL,
  `shorttitle` varchar(250) DEFAULT NULL,
  `ischeck` tinyint(4) DEFAULT '1',
  `flag` set('c','h','p','f','s','j','a','b') DEFAULT NULL,
  `writer` char(20) DEFAULT '管理员',
  `source` char(30) DEFAULT '原创',
  `click` int(8) DEFAULT '0',
  `litpic` varchar(100) DEFAULT NULL,
  `startdate` int(10) DEFAULT '0',
  `keywords` varchar(100) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `tag` varchar(255) DEFAULT '',
  `groups` varchar(255) DEFAULT '',
  `con` mediumtext,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_comment`;

CREATE TABLE `k_comment` (
  `commentid` int(11) NOT NULL AUTO_INCREMENT,
  `ifcheck` tinyint(4) DEFAULT '0',
  `chinnel` tinyint(4) DEFAULT '0',
  `tid` int(11) DEFAULT '0',
  `rid` int(11) DEFAULT '0',
  `aid` int(11) DEFAULT '0',
  `good` int(11) DEFAULT '0',
  `bad` int(11) DEFAULT '0',
  `nick` varchar(20) DEFAULT '',
  `senddate` int(11) DEFAULT '0',
  `ip` char(15) DEFAULT '',
  `con` text,
  PRIMARY KEY (`commentid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_config`;

CREATE TABLE `k_config` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `group` tinyint(4) DEFAULT '1',
  `type` tinyint(4) DEFAULT '1',
  `des` varchar(100) DEFAULT NULL,
  `name` varchar(200) DEFAULT NULL,
  `values` text,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_diyforms`;

CREATE TABLE `k_diyforms` (
  `diyid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) DEFAULT '',
  `table` varchar(50) DEFAULT '',
  `con` text,
  `public` tinyint(1) DEFAULT '1',
  PRIMARY KEY (`diyid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_log`;

CREATE TABLE `k_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `intype` tinyint(4) DEFAULT NULL,
  `createdate` datetime DEFAULT NULL,
  `masterid` int(11) DEFAULT '0',
  `bmasterid` int(11) DEFAULT NULL,
  `ip` varchar(15) DEFAULT '',
  `con` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_master`;

CREATE TABLE `k_master` (
  `masterid` smallint(6) NOT NULL AUTO_INCREMENT,
  `name` varchar(20) DEFAULT NULL COMMENT '管理员名称',
  `pwd` char(20) DEFAULT NULL,
  `intime` datetime DEFAULT NULL COMMENT '创建时间',
  `nick` varchar(20) DEFAULT NULL COMMENT '昵称',
  `createid` smallint(6) DEFAULT NULL COMMENT '创建者',
  PRIMARY KEY (`masterid`),
  UNIQUE KEY `unique` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_masterrole`;

CREATE TABLE `k_masterrole` (
  `masterroleid` int(11) NOT NULL AUTO_INCREMENT,
  `masterid` smallint(6) DEFAULT NULL COMMENT '管理员ID',
  `name` varchar(20) DEFAULT NULL COMMENT '管理员名称',
  `roleid` int(11) DEFAULT NULL COMMENT '管理组id',
  `masterid2` int(11) DEFAULT NULL COMMENT '修改者id',
  PRIMARY KEY (`masterroleid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_role`;

CREATE TABLE `k_role` (
  `roleid` int(11) NOT NULL AUTO_INCREMENT,
  `rolename` varchar(20) DEFAULT NULL COMMENT '管理组名称',
  `roleinfo` varchar(50) DEFAULT NULL COMMENT '管理组信息',
  `masterid` int(11) DEFAULT NULL COMMENT '创建者id',
  `createdate` datetime DEFAULT NULL COMMENT '组创建时间',
  PRIMARY KEY (`roleid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_tag`;

CREATE TABLE `k_tag` (
  `tagid` int(11) NOT NULL AUTO_INCREMENT,
  `tagname` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`tagid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_taglist`;

CREATE TABLE `k_taglist` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tagid` int(11) DEFAULT NULL,
  `aid` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `k_uploads`;

CREATE TABLE `k_uploads` (
  `upid` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `arcid` mediumint(8) unsigned DEFAULT '0',
  `arctype` int(6) DEFAULT '0',
  `channeltype` smallint(6) DEFAULT '1',
  `mediatype` varchar(60) NOT NULL DEFAULT '',
  `url` varchar(80) NOT NULL DEFAULT '',
  `filesize` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `width` varchar(80) DEFAULT '',
  `height` varchar(80) DEFAULT '',
  `intime` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`upid`),
  KEY `arcid` (`arcid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

