-- 6.0.2
ALTER TABLE `#@__tagindex` ADD COLUMN `keywords` VARCHAR(255) NULL DEFAULT NULL AFTER `tag`;
ALTER TABLE `#@__tagindex` ADD COLUMN `description` VARCHAR(255) NULL DEFAULT NULL AFTER `keywords`;
ALTER TABLE `#@__tagindex` ADD COLUMN `title` VARCHAR(255) NULL DEFAULT NULL AFTER `description`;
ALTER TABLE `#@__tagindex` ADD COLUMN `tag_pinyin` VARCHAR(255) NULL DEFAULT NULL AFTER `title`;

-- 6.0.3
ALTER TABLE `#@__tagindex` 
	ADD COLUMN `uptime` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `addtime`,
	ADD COLUMN `mktime` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `uptime`;
ALTER TABLE `#@__feedback` ADD COLUMN `fid` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `aid`;
ALTER TABLE `#@__feedback` ADD COLUMN `replycount` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `dtime`;
INSERT INTO `#@__sysconfig` (`varname`, `info`, `groupid`, `type`, `value`) VALUES ('cfg_feedback_msglen', '评论内容字数限定', 5, 'number', '200');
INSERT INTO `#@__sysconfig` (`varname`, `info`, `groupid`, `type`, `value`) VALUES ('cfg_auth_code', '商业版授权码', 1, 'string', '');
INSERT INTO `#@__sysconfig` (`varname`, `info`, `groupid`, `type`, `value`) VALUES ('cfg_bizcore_hostname', 'DedeBIZ Core地址', 1, 'string', '127.0.0.1');
INSERT INTO `#@__sysconfig` (`varname`, `info`, `groupid`, `type`, `value`) VALUES ('cfg_bizcore_port', 'DedeBIZ Core端口', 1, 'number', '8181');
INSERT INTO `#@__sysconfig` (`varname`, `info`, `groupid`, `type`, `value`) VALUES ('cfg_bizcore_appid', 'DedeBIZ Core应用ID', 1, 'string', '');
INSERT INTO `#@__sysconfig` (`varname`, `info`, `groupid`, `type`, `value`) VALUES ('cfg_bizcore_key', 'DedeBIZ Core通信密钥', 1, 'string', '');
CREATE TABLE `#@__feedback_goodbad` (
	`fgid` INT(11) NOT NULL AUTO_INCREMENT,
	`mid` INT(11) NOT NULL DEFAULT '0',
	`fid` INT(11) NOT NULL DEFAULT '0',
	`fgtype` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '0:good 1:bad',
	PRIMARY KEY (`fgid`)
) TYPE=MyISAM;
CREATE TABLE `#@__search_limits` (
	`ip` VARCHAR(200) NOT NULL,
	`searchtime` INT(11) NULL DEFAULT NULL,
	PRIMARY KEY (`ip`)
) TYPE=MyISAM;

-- 6.1.0
ALTER TABLE `#@__arctype` ADD COLUMN `namegk` varchar(255) NULL AFTER `typename`,
	ADD COLUMN `enname` varchar(255) NULL AFTER `namegk`,
	ADD COLUMN `ennamegk` varchar(255) NULL AFTER `enname`,
	ADD COLUMN `litpic` varchar(255) NULL AFTER `ennamegk`,
	ADD COLUMN `litimg` varchar(255) NULL AFTER `litpic`;

-- 6.1.7
CREATE TABLE `#@__statistics` (`id` int NOT NULL AUTO_INCREMENT,
	`sdate` int DEFAULT NULL COMMENT '记录日期',
	`pv` int DEFAULT NULL COMMENT 'PV',
	`uv` int DEFAULT NULL COMMENT 'UV',
	`ip` int DEFAULT NULL COMMENT 'IP',
	`vv` int DEFAULT NULL COMMENT 'vv',
	PRIMARY KEY (`id`)
) TYPE=MyISAM;
CREATE TABLE `#@__statistics_detail` (`id` int NOT NULL AUTO_INCREMENT,
	`t` int DEFAULT NULL COMMENT 'unixtime',
	`created_date` int DEFAULT NULL COMMENT '日期，20220326',
	`created_hour` int DEFAULT NULL COMMENT '时间，12',
	`dduuid` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'uuid',
	`ssid` varchar(32) DEFAULT NULL COMMENT 'session_id',
	`ip` varchar(46) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '地址ip',
	`browser` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '浏览器',
	`device` varchar(50) DEFAULT NULL COMMENT '设备',
	`device_type` varchar(10) DEFAULT NULL COMMENT '设备类型',
	`os` varchar(20) DEFAULT NULL COMMENT '操作系统',
	`url_type` tinyint DEFAULT NULL COMMENT '浏览地址类型：0:未知 1:列表 2:文档 3:搜索 4:标签',
	`typeid` int DEFAULT NULL COMMENT '栏目id',
	`aid` int DEFAULT NULL COMMENT '文档id',
	`value` varchar(50) DEFAULT NULL COMMENT '值',
	PRIMARY KEY (`id`),
	KEY `idx_created_date_dduuid` (`created_date`,`dduuid`),
	KEY `idx_created_date_ip` (`created_date`,`ip`),
	KEY `idx_created_date_ssid` (`created_date`,`ssid`)
) TYPE=MyISAM;
ALTER TABLE `#@__addonarticle` MODIFY COLUMN `userip` char(46) NOT NULL DEFAULT '' AFTER `templet`;
ALTER TABLE `#@__addonimages` MODIFY COLUMN `userip` char(46) NOT NULL DEFAULT '' AFTER `templet`;
ALTER TABLE `#@__addoninfos` MODIFY COLUMN `userip` varchar(46) NOT NULL DEFAULT '' AFTER `litpic`;
ALTER TABLE `#@__addonshop` MODIFY COLUMN `userip` char(46) NOT NULL DEFAULT '' AFTER `templet`;
ALTER TABLE `#@__addonsoft` MODIFY COLUMN `userip` char(46) NOT NULL DEFAULT '' AFTER `templet`;
ALTER TABLE `#@__addonspec` MODIFY COLUMN `userip` char(46) NOT NULL DEFAULT '' AFTER `templet`;
ALTER TABLE `#@__admin` MODIFY COLUMN `loginip` varchar(46) NOT NULL DEFAULT '' AFTER `logintime`;
ALTER TABLE `#@__feedback` MODIFY COLUMN `ip` char(46) NOT NULL DEFAULT '' AFTER `arctitle`;
ALTER TABLE `#@__log` MODIFY COLUMN `cip` char(46) NOT NULL DEFAULT '' AFTER `query`;
ALTER TABLE `#@__member` MODIFY COLUMN `joinip` char(46) NOT NULL DEFAULT '' AFTER `jointime`,MODIFY COLUMN `loginip` char(46) NOT NULL DEFAULT '' AFTER `logintime`;
ALTER TABLE `#@__shops_orders` MODIFY COLUMN `ip` char(46) NOT NULL DEFAULT '' AFTER `state`;
ALTER TABLE `#@__dl_log` MODIFY COLUMN `ip` char(46) NOT NULL AFTER `id`;
ALTER TABLE `#@__addoninfos` MODIFY COLUMN `nativeplace` char(20) NOT NULL DEFAULT 0 AFTER `badpost`;

-- 6.1.8
INSERT INTO `#@__sysconfig` VALUES ('151', 'cfg_tags_dir', '标签生成目录', 7, 'string', '{cmspath}/a/tags');
ALTER TABLE `#@__tagindex` DROP COLUMN `tag_pinyin`;

-- 6.1.9
ALTER TABLE `#@__archives` MODIFY COLUMN `title` varchar(255) NOT NULL DEFAULT '' AFTER `money`;
ALTER TABLE `#@__arctype` MODIFY COLUMN `typename` varchar(255) NOT NULL DEFAULT '' AFTER `sortrank`;
ALTER TABLE `#@__admin` ADD COLUMN `pwd_new` varchar(120) NOT NULL DEFAULT '' AFTER `pwd`;
ALTER TABLE `#@__member` ADD COLUMN `pwd_new` varchar(120) NOT NULL DEFAULT '' AFTER `pwd`;

-- 6.1.10
ALTER TABLE `#@__arctype` CHANGE `namegk` `cnoverview` CHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `#@__arctype` CHANGE `ennamegk` `enoverview` CHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `#@__arctype` CHANGE `litpic` `bigpic` CHAR(255) NOT NULL DEFAULT '';
DELETE FROM `#@__sysconfig` WHERE `#@__sysconfig`.`varname` = 'cfg_disable_funs';
DELETE FROM `#@__sysconfig` WHERE `#@__sysconfig`.`varname` = 'cfg_disable_tags';
DELETE FROM `#@__sysconfig` WHERE `#@__sysconfig`.`varname` = 'cfg_vdcode_member';

-- 6.2.0
ALTER TABLE `#@__arctype` CHANGE COLUMN `iscross` `cross` tinyint(1) NOT NULL DEFAULT 0 AFTER `ishidden`;
ALTER TABLE `#@__admin` ADD COLUMN `loginerr` tinyint NULL DEFAULT 0 AFTER `loginip`;
ALTER TABLE `#@__member` ADD COLUMN `loginerr` tinyint NULL DEFAULT 0 AFTER `checkmail`;
ALTER TABLE `#@__member` ADD COLUMN `send_max` int NULL DEFAULT 1 AFTER `loginerr`;

-- 6.2.3
INSERT INTO `#@__sysconfig` (`varname`, `info`, `groupid`, `type`, `value`) VALUES ('cfg_bizcore_api', 'DedeBIZ Core接口服务器', 1, 'string', 'http://localhost:8087');

-- 6.2.5
CREATE TABLE `#@__sys_payment` (`id` int(11) unsigned NOT NULL auto_increment,
	`code` varchar(20) NOT NULL DEFAULT '',
	`name` varchar(32) NOT NULL DEFAULT '',
	`short_name` varchar(32) DEFAULT '',
	`sortrank` int(3) unsigned NOT NULL DEFAULT '0',
	`config` text NOT NULL,
	`status` int(3) unsigned NOT NULL DEFAULT '0',
	PRIMARY KEY (`id`)
) TYPE=MyISAM;
INSERT INTO `#@__sys_payment`(`id`, `code`, `name`, `short_name`, `sortrank`, `config`, `status`) VALUES (1, 'Wechat', '微信支付', '微信', 0, '{"AppID":"","MchID":"","APIv2Secret":""}', 0);
INSERT INTO `#@__sys_payment`(`id`, `code`, `name`, `short_name`, `sortrank`, `config`, `status`) VALUES (2, 'Alipay', '支付宝支付', '支付宝', 1, '{"APPID":"","PrivateKey":"","CertPublicKey":"","RootCert":"AlipayRootCert","SignType":"RSA2"}', 0);
INSERT INTO `#@__sys_payment`(`id`, `code`, `name`, `short_name`, `sortrank`, `config`, `status`) VALUES (3, 'Bank', '银行转账', '转账', 2, '{"AccountName":"泰隆商业银行上海杨浦支行","AccountNO":"31010090201000020658","Name":"上海穆云智能科技有限公司"}', 1);
INSERT INTO `#@__sys_payment`(`id`, `code`, `name`, `short_name`, `sortrank`, `config`, `status`) VALUES (4, 'Balance', '余额支付', '余额', 3, '{}', 1);
INSERT INTO `#@__sys_payment`(`id`, `code`, `name`, `short_name`, `sortrank`, `config`, `status`) VALUES (5, 'Cod', '货到付款', '货到付款', 4, '{}', 0);
ALTER TABLE `#@__member` ADD COLUMN `user_money` decimal(10, 2) UNSIGNED NULL DEFAULT 0.00 AFTER `send_max`;

-- 6.2.7
ALTER TABLE `#@__arctype` ADD COLUMN `apienabled` tinyint UNSIGNED NULL DEFAULT 0 AFTER `smalltypes`,ADD COLUMN `apikey` varchar(64) NULL AFTER `apienabled`;
ALTER TABLE `#@__member` ADD COLUMN `pmid` INT(8) UNSIGNED NULL DEFAULT 0 AFTER `user_money`;

-- 6.2.11
UPDATE `#@__channeltype` SET `useraddcon` = 'soft_add.php', `usermancon` = 'content_list.php', `usereditcon` = 'soft_edit.php' WHERE `id` = 3;
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_mkdir';
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_host';
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_port';
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_user';
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_pwd';
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_root';
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_mkdir';
CREATE TABLE `#@__search_sync`  (
  `id` int unsigned NOT NULL auto_increment,
  `aid` int NULL DEFAULT NULL,
  `sync_status` tinyint NULL DEFAULT 0,
  `add_at` int NULL DEFAULT NULL,
  `update_at` int NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) TYPE=MyISAM;