begin;

CREATE TABLE `t_hash_rate` (
  `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
  `task_id` int(11) NOT NULL COMMENT '配置表id',
  `period` int(11) NOT NULL DEFAULT '0' COMMENT '算力期数',
  `reward` int(64) NOT NULL DEFAULT '0' COMMENT '奖励',
  `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  PRIMARY KEY (`idx`),
  UNIQUE KEY `account_period_task_id` (`account_id`,`period`, `task_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `t_hash_rate_battle_data` (
  `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
  `battle_data` mediumblob COMMENT 'battle_data',
  `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  PRIMARY KEY (`idx`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;


CREATE TABLE `t_global_data` (
  `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `name` varchar(60)  NOT NULL DEFAULT '' COMMENT '参数名',
  `data` mediumblob COMMENT 'data',
  `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  PRIMARY KEY (`idx`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

alter table t_chip add column `quality` int(11) NOT NULL DEFAULT '0' COMMENT '品阶';

insert into version (version) values(2023122801);

commit;
