/*
	VeryIDE
	Version: 3.0
	Database: module
	Date: 16:40 2010/4/12
*/

-- ----------------------------
-- 广告位
-- ----------------------------
DROP TABLE IF EXISTS `{TablePre}adsarea`;
CREATE TABLE `{TablePre}adsarea` (
  `id` int(11) NOT NULL auto_increment,
  `aid` int(11) NOT NULL,
  `account` varchar(30) NOT NULL,
  `parent` int(11) NOT NULL,
  `name` varchar(20) NOT NULL,
  `key` varchar(20) default NULL,
  `quote` varchar(100) default NULL,
  `number` tinyint(4) NOT NULL,
  `preview` varchar(100) default NULL,
  `variable` varchar(250) default NULL,
  `show` tinyint(4) NOT NULL,
  `templet` text NOT NULL,
  `modify` datetime default NULL,
  `price` mediumint(11) NOT NULL,
  `width` int(11) NOT NULL,
  `height` int(11) NOT NULL,
  `unit` varchar(10) default NULL,
  `tag` varchar(10) default NULL,
  `description` varchar(300) default NULL,
  `config` text NOT NULL,
  `dateline` int(11) NOT NULL,
  `state` tinyint(4) NOT NULL default '0',
  `ip` varchar(15) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `aid` (`aid`),
  KEY `account` (`account`),
  KEY `parent` (`parent`),
  KEY `state` (`state`),
  KEY `show` (`show`),
  KEY `name` (`name`),
  UNIQUE KEY `key` (`key`)
) ENGINE=MyISAM;

-- ----------------------------
-- 广告表
-- ----------------------------
DROP TABLE IF EXISTS `{TablePre}adsview`;
CREATE TABLE `{TablePre}adsview` (
  `id` int(11) NOT NULL auto_increment,
  `type` int(11) NOT NULL,
  `parent` int(11) NOT NULL,
  `aid` int(11) NOT NULL,
  `account` varchar(30) NOT NULL,
  `category` varchar(30) default NULL,
  `name` varchar(100) NOT NULL,
  `owner` int(11) NOT NULL,
  `contract` varchar(20) default NULL,
  `custom` varchar(30) default NULL,
  `contact` varchar(30) default NULL,
  `file` varchar(255) default NULL,
  `script` text,
  `link` varchar(255) default NULL,
  `width` smallint(11) NOT NULL,
  `height` smallint(11) NOT NULL,
  `form` tinyint(4) NOT NULL default '0',
  `sort` int(11) NOT NULL default '1',
  `spare` tinyint(4) NOT NULL default '0',
  `dateline` int(11) NOT NULL,
  `modify` int(11) default NULL,
  `mender` varchar(30) default NULL,
  `end` int(11) default NULL,
  `start` int(11) NOT NULL,
  `expire` int(11) NOT NULL,
  `engage` tinyint(4) NOT NULL default '0',
  `config` text NOT NULL,
  `description` text,
  `tags` varchar(50) default NULL,
  `share` varchar(100) NOT NULL,
  `zone` varchar(100) NOT NULL,
  `state` tinyint(4) NOT NULL default '0',
  `ar` int(11) NOT NULL COMMENT 'accounts receivable',
  `pr` int(11) NOT NULL COMMENT 'paid receivable',
  `ip` varchar(15) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `type` (`type`),
  KEY `parent` (`parent`),
  KEY `aid` (`aid`),
  KEY `account` (`account`),
  KEY `category` (`category`),
  KEY `name` (`name`),
  KEY `owner` (`owner`),
  KEY `form` (`form`),
  KEY `start` (`start`),
  KEY `expire` (`expire`),
  KEY `tags` (`tags`),
  KEY `share` (`share`),
  KEY `zone` (`zone`),
  KEY `state` (`state`),
  KEY `spare` (`spare`)
) ENGINE=MyISAM;

-- ----------------------------
-- 统计分析
-- ----------------------------
DROP TABLE IF EXISTS `{TablePre}analytic`;
CREATE TABLE `{TablePre}analytic` (
  `id` int(11) NOT NULL auto_increment,
  `appkey` varchar(30) NOT NULL,
  `category` varchar(10) default NULL,
  `date` varchar(10) default NULL,
  `views` int(11) NOT NULL,
  `clicks` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `appkey` (`appkey`),
  KEY `category` (`category`),
  KEY `date` (`date`)
) ENGINE=MyISAM;

-- ----------------------------
-- 表单
-- ----------------------------
DROP TABLE IF EXISTS `{TablePre}form`;
CREATE TABLE `{TablePre}form` (
  `id` int(11) NOT NULL auto_increment,
  `appid` varchar(15) NOT NULL,
  `aid` int(11) NOT NULL,
  `account` varchar(30) NOT NULL,
  `category` varchar(30) default NULL,
  `thumb` varchar(100) default NULL,
  `name` varchar(100) NOT NULL,
  `config` text,
  `description` varchar(1000) default NULL,
  `color` varchar(10) default NULL,
  `tags` varchar(100) default NULL,
  `state` tinyint(4) NOT NULL,
  `skin` varchar(20) default NULL,
  `stat` mediumint(9) NOT NULL default '0',
  `sort` int(11) NOT NULL default '0',
  `quote` varchar(100) default NULL,
  `start` int(11) NOT NULL,
  `expire` int(11) NOT NULL,
  `dateline` int(11) NOT NULL,
  `modify` int(11) default NULL,
  `mender` varchar(30) default NULL,
  `ip` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `appid` (`appid`),
  KEY `aid` (`aid`),
  KEY `account` (`account`),
  KEY `category` (`category`),
  KEY `name` (`name`),
  KEY `tags` (`tags`)
) ENGINE=MyISAM;

-- ----------------------------
-- 表单——选项组
-- ----------------------------
DROP TABLE IF EXISTS `{TablePre}group`;
CREATE TABLE `{TablePre}group` (
  `id` int(11) NOT NULL auto_increment,
  `fid` int(11) NOT NULL,
  `aid` int(11) NOT NULL,
  `account` varchar(30) NOT NULL,
  `name` varchar(100) default NULL,
  `type` varchar(20) default NULL,
  `dateline` int(11) NOT NULL,
  `modify` int(11) NOT NULL,
  `state` tinyint(4) NOT NULL,
  `sort` mediumint(9) NOT NULL,
  `config` varchar(1000) default NULL,
  `selected` varchar(255) default NULL,
  `description` text,
  `stat` mediumint(9) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `fid` (`fid`),
  KEY `aid` (`aid`),
  KEY `account` (`account`),
  KEY `name` (`name`),
  KEY `sort` (`sort`)
) ENGINE=MyISAM;

-- ----------------------------
-- 表单——子选项
-- ----------------------------
DROP TABLE IF EXISTS `{TablePre}option`;
CREATE TABLE `{TablePre}option` (
  `id` int(11) NOT NULL auto_increment,
  `aid` int(11) NOT NULL,
  `account` varchar(30) NOT NULL,
  `fid` int(11) NOT NULL,
  `gid` int(11) default NULL,
  `name` varchar(200) NOT NULL,
  `dateline` int(11) default NULL,
  `sort` mediumint(9) default NULL,
  `config` varchar(255) default NULL,
  `description` varchar(1000) default NULL,
  `quote` varchar(100) default NULL,
  `image` varchar(100) default NULL,
  `state` tinyint(4) default '1',
  `stat` mediumint(9) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `aid` (`aid`),
  KEY `account` (`account`),
  KEY `fid` (`fid`),
  KEY `gid` (`gid`),
  KEY `sort` (`sort`),
  KEY `name` (`name`)
) ENGINE=MyISAM;

-- ----------------------------
-- 表单——用户数据
-- ----------------------------
DROP TABLE IF EXISTS `{TablePre}value`;
CREATE TABLE `{TablePre}value` (
  `id` int(11) NOT NULL auto_increment,
  `fid` int(11) NOT NULL,
  `appid` varchar(15) NOT NULL,
  `uid` int(11) NOT NULL,
  `account` varchar(30) default NULL,
  `config` text,
  `state` tinyint(4) NOT NULL,
  `dateline` int(11) NOT NULL,
  `ip` varchar(15) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `account` (`account`),
  KEY `fid` (`fid`),
  KEY `appid` (`appid`),
  KEY `uid` (`uid`)
) ENGINE=MyISAM;

-- ----------------------------
-- 统计表
-- ----------------------------
DROP TABLE IF EXISTS `{TablePre}go`;
CREATE TABLE `{TablePre}go` (
  `id` int(11) NOT NULL auto_increment,
  `aid` int(11) default NULL,
  `account` varchar(30) NOT NULL,
  `category` varchar(30) default NULL,
  `name` varchar(100) NOT NULL,
  `method` varchar(10) NOT NULL,
  `link` varchar(255) default NULL,
  `dateline` int(11) NOT NULL,
  `modify` int(11) NOT NULL,
  `mender` varchar(30) default NULL,
  `ip` varchar(15) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `aid` (`aid`),
  KEY `account` (`account`),
  KEY `category` (`category`),
  KEY `name` (`name`),
  KEY `method` (`method`),
  KEY `link` (`link`)
) ENGINE=MyISAM;

-- ----------------------------
-- 会员表
-- ----------------------------
DROP TABLE IF EXISTS `{TablePre}member`;
CREATE TABLE `{TablePre}member` (
  `id` int(11) NOT NULL,
  `account` varchar(40) NOT NULL,
  `name` varchar(40) default '',
  `sex` tinyint(4) default NULL,
  `blood` varchar(5) default NULL,
  `birthday` varchar(10) default NULL,
  `email` varchar(30) default NULL,
  `phone` varchar(15) default NULL,
  `qq` varchar(30) default NULL,
  `msn` varchar(30) default NULL,
  `idcard` varchar(20) default NULL,
  `address` varchar(50) default NULL,
  `marriage` tinyint(4) default NULL,
  `blog` varchar(100) default NULL,
  `career` varchar(100) default NULL,
  `company` varchar(100) default NULL,
  `school` varchar(100) default NULL,
  `tag_book` varchar(255) default NULL,
  `tag_music` varchar(255) default NULL,
  `tag_movie` varchar(255) default NULL,
  `tag_sport` varchar(255) default NULL,
  `tag_person` varchar(255) default NULL,
  `tag_other` varchar(255) default NULL,
  `tag_brand` varchar(255) default NULL,
  `tag_color` varchar(255) default NULL,
  `tag_yearn` varchar(255) default NULL,
  `stat_login` mediumint(9) default '0',
  `stat_level` mediumint(9) default '0',
  `stat_credit` mediumint(9) default '0',
  `config` varchar(255) default NULL,
  `auth` tinyint(4) NOT NULL default '0',
  `photo` varchar(100) default NULL,
  `identity` varchar(100) default NULL,
  `dateline` int(11) NOT NULL,
  `modify` int(11) NOT NULL default '0',
  `state` tinyint(4) default '1',
  `ip` varchar(15) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `account` (`account`),
  KEY `name` (`name`),
  KEY `sex` (`sex`),
  KEY `qq` (`qq`),
  KEY `email` (`email`),
  KEY `phone` (`phone`),
  KEY `idcard` (`idcard`),
  KEY `state` (`state`),
  KEY `stat_credit` (`stat_credit`),
  KEY `marriage` (`marriage`)
) ENGINE=MyISAM;

-- ----------------------------
-- 消费记录表
-- ----------------------------
DROP TABLE IF EXISTS `{TablePre}consume`;
CREATE TABLE `{TablePre}consume`(
  `id` int(11) NOT NULL auto_increment,
  `appid` varchar(15) NOT NULL,
  `fid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `account` varchar(20) NOT NULL,
  `price` int(11) NOT NULL,
  `final` tinyint(4) NOT NULL,
  `bingo` tinyint(4) NOT NULL,
  `dateline` int(11) NOT NULL,
  `state` tinyint(4) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `appid` (`appid`),
  KEY `fid` (`fid`),
  KEY `state` (`state`),
  KEY `account` (`account`),
  KEY `uid` (`uid`)
) ENGINE=MyISAM;

-- ----------------------------
-- 用户评论表
-- ----------------------------
DROP TABLE IF EXISTS `{TablePre}comment`;
CREATE TABLE `{TablePre}comment` (
  `id` int(11) NOT NULL auto_increment,
  `appid` varchar(20) NOT NULL,
  `fid` int(11) NOT NULL,
  `uid` int(11) NOT NULL,
  `account` varchar(20) NOT NULL,
  `state` int(11) NOT NULL,
  `rate` tinyint(4) default NULL,
  `event` tinyint(4) default NULL,
  `extra` tinyint(4) default NULL,
  `extrb` tinyint(4) default NULL,
  `extrc` tinyint(4) default NULL,
  `extrd` tinyint(4) default NULL,
  `price` smallint(6) default NULL,
  `tags` varchar(100) default NULL,
  `question` text NOT NULL,
  `site_answer` varchar(255) default NULL,
  `site_dateline` int(11) default NULL,
  `host_answer` varchar(255) default NULL,
  `host_dateline` int(11) default NULL,
  `dateline` int(11) NOT NULL,
  `modify` int(11) default NULL,
  `ip` varchar(15) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `appid` (`appid`),
  KEY `fid` (`fid`),
  KEY `uid` (`uid`),
  KEY `tags` (`tags`),
  KEY `rate` (`rate`),
  KEY `event` (`event`),
  KEY `state` (`state`),
  KEY `modify` (`modify`)
) ENGINE=MyISAM;

-- ----------------------------
-- 内容分类表
-- ----------------------------
DROP TABLE IF EXISTS `{TablePre}category`;
CREATE TABLE `{TablePre}category` (
  `id` int(11) NOT NULL auto_increment,
  `appid` varchar(30) NOT NULL,
  `name` varchar(100) NOT NULL,
  `mark` varchar(30) default NULL,
  `title` varchar(100) default NULL,
  `keywords` varchar(500) default NULL,
  `description` varchar(1000) default NULL,
  `config` text NOT NULL,
  `mode` tinyint(4) NOT NULL,
  `parent` int(11) NOT NULL default '0',
  `dateline` int(11) NOT NULL,
  `modify` int(11) default NULL,
  `bind` varchar(30) default NULL,
  `ping` text,
  `link` varchar(100) default NULL,
  `skin` varchar(20) default NULL,
  `sort` int(11) default NULL,
  `stat` int(11) default '0',
  `state` tinyint(4) NOT NULL default '0',
  `ip` varchar(15) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `parent` (`parent`),
  KEY `name` (`name`),
  KEY `state` (`state`),
  KEY `appid` (`appid`)
) ENGINE=MyISAM;
