begin;

alter table user add column `diamond_num` bigint NOT NULL DEFAULT '0' COMMENT '钻石数量';
alter table user add column `diamond_shop_flush_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日钻石商店刷新次数';
alter table user add column `sum_coin` double NOT NULL DEFAULT '0' COMMENT '累计充值金额';
alter table user add column `recharge_times_total` int(11) NOT NULL DEFAULT '0' COMMENT '累计充值次数';
alter table user add column `pass_status` int(11) NOT NULL DEFAULT '0' COMMENT '通行证购买状态';
alter table user add column `score`     int(11) NOT NULL DEFAULT '0' COMMENT '通行证积分';
alter table user add column `season_status` int(11) NOT NULL DEFAULT '0' COMMENT '赛季奖励状态';
alter table user add column `first_gift` int(11) NOT NULL DEFAULT '0' COMMENT '首充礼包领取状态';
alter table user add column `season_time` int(11) NOT NULL DEFAULT '0' COMMENT '赛季结束时间';
alter table user add column `free_coin`    int(11) NOT NULL DEFAULT '0' COMMENT '每日免费金币';
alter table user add column `free_diamond` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费钻石';
alter table user add column `season_end_score` int(11) NOT NULL DEFAULT '0' COMMENT '赛季结算积分';


CREATE TABLE `buy_his` (
  `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
  `itemid` int(11) NOT NULL DEFAULT '0' COMMENT 'itemid',
  `sum_times` int(11) NOT NULL DEFAULT '0' COMMENT '累计充值次数',
  `today_times` int(11) NOT NULL DEFAULT '0' COMMENT '今日充值次数',
  `last_buy_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后购买时间',
  `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `modify_time` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  PRIMARY KEY (`idx`),
  KEY `accountid` (`accountid`),
  UNIQUE KEY `accountid_itemid` (`accountid`, `itemid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `orderinfo` (
  `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
  `orderid` varchar(60) DEFAULT '' COMMENT '订单id',
  `itemid` int(11) NOT NULL DEFAULT '0' COMMENT 'itemid',
  `coin` double NOT NULL DEFAULT '0' COMMENT '充值金额',
  `status` int(11) NOT NULL DEFAULT '0' COMMENT '0: 新添加订单 1:已经完成订单',
  `item_list` mediumblob COMMENT 'item_list',
  `confirmtime` int(11) NOT NULL DEFAULT '0' COMMENT 'GameServer订单确认时间',
  `create_time`   int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `modify_time`   int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  PRIMARY KEY (`idx`),
  UNIQUE KEY `orderid` (`orderid`),
  KEY `accountid` (`accountid`),
  KEY `accountid_itemid` (`accountid`, `itemid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `vipinfo` (
  `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
  `vipid` int(11) NOT NULL DEFAULT '0' COMMENT 'vipid',
  `reward_id` int(11) NOT NULL DEFAULT '0' COMMENT '奖励id',
  `reward_status` int(11) NOT NULL DEFAULT '0' COMMENT '奖励状态',
  `today_reward_id` int(11) NOT NULL DEFAULT '0' COMMENT '今日奖励id',
  `today_reward_status` int(11) NOT NULL DEFAULT '0' COMMENT '今日奖励状态',
  `create_time`   int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `modify_time`   int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  PRIMARY KEY (`idx`),
  KEY `accountid` (`accountid`),
  UNIQUE KEY `accountid_vipid` (`accountid`, `vipid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `passinfo` (
  `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
  `passid` int(11) NOT NULL DEFAULT '0' COMMENT 'passid',
  `active_status` int(11) NOT NULL DEFAULT '0' COMMENT '普通奖励状态',
  `honor_status` int(11) NOT NULL DEFAULT '0' COMMENT '荣耀奖励状态',
  `create_time`   int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `modify_time`   int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  PRIMARY KEY (`idx`),
  KEY `accountid` (`accountid`),
  UNIQUE KEY `accountid_passid` (`accountid`, `passid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `emoji` (
  `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id',
  `emojiid` int(11) NOT NULL DEFAULT '0' COMMENT 'emojiid',
  `status` int(11) NOT NULL DEFAULT '0' COMMENT '状态',
  `create_time`   int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `modify_time`   int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  PRIMARY KEY (`idx`),
  KEY `accountid` (`accountid`),
  UNIQUE KEY `accountid_emojiid` (`accountid`, `emojiid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

insert into version (version) values(2019082701);

commit;
