-- 循环进阶日志
CREATE TABLE `log_foster_loop` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '玩家id',
  `role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
  `subtype` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '活动子类',
  `grade` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '奖励档次',
  `cons` varchar(255) NOT NULL DEFAULT '[]' COMMENT '领取条件',
  `curgrade` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '当前阶',
  `curstar` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '当前星',
  `nextcons` varchar(255) NOT NULL DEFAULT '[]' COMMENT '下一档条件',
  `awards` varchar(255) NOT NULL DEFAULT '[]' COMMENT '奖励',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`),
  KEY role_id(`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='循环进阶日志';


drop table if exists log_race_rank_draw;
CREATE TABLE `log_race_rank_draw` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
  `act_id` int(11) unsigned NOT NULL COMMENT '活动Id',
  `award` varchar(800) NOT NULL DEFAULT '[]' COMMENT '奖励:[{奖励类型,物品类型Id,数量}]',
  `cost` varchar(100) NOT NULL DEFAULT '[]' COMMENT '消耗:[{奖励类型,物品类型Id,数量}]',
  `isbuy` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '是否购买',
  `befgold` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'gold前',
  `aftgold` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'gold后',
  `times` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '抽奖后积分',
  `score` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '抽奖后积分',
  `vip` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'VIP',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间戳',
  PRIMARY KEY (`id`),
  KEY role_id(`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='跨服竞榜活动-玩家抽奖记录(在游戏服中使用)';


CREATE TABLE `log_race_rank_times_award` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
  `act_id` int(11) unsigned NOT NULL COMMENT '活动Id',
  `grade` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '奖励档次',
  `awards` varchar(200) NOT NULL DEFAULT '[]' COMMENT '奖励',
  `needscore` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '需求积分',
  `curscore` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '当前积分',
  `vip` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'VIP',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间戳',
  PRIMARY KEY (`id`),
  KEY role_id(`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='竞榜阶段奖励日志';

drop table if exists log_race_rank;
CREATE TABLE `log_race_rank_kf` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `act_id` int(11) unsigned NOT NULL COMMENT '活动Id',
  `zone_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分区Id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `rname` varchar(50) NOT NULL DEFAULT '' COMMENT '角色名字',
  `server_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '服务器Id(后台唯一服号)',
  `server_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '服务器编号(玩家可见的服编号)',
  `stime` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '活动开始时间',
  `etime` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '活动结束时间',
  `score` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '积分',
  `rank` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排名',
  `ctime` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间戳',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '日志时间戳',
  PRIMARY KEY (`id`),
  KEY act_id(`act_id`),
  KEY role_id(`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='跨服竞榜活动-排行榜跨服日志';

CREATE TABLE `log_race_rank` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `act_id` int(11) unsigned NOT NULL COMMENT '活动Id',
  `zone_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分区Id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `rname` varchar(50) NOT NULL DEFAULT '' COMMENT '角色名字',
  `stime` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '活动开始时间',
  `etime` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '活动结束时间',
  `score` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '积分',
  `rank` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排名',
  `ctime` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间戳',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '日志时间戳',
  PRIMARY KEY (`id`),
  KEY act_id(`act_id`),
  KEY role_id(`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='跨服竞榜活动-排行榜本地日志';


CREATE TABLE `log_mobilize_award` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
  `act_id` int(11) unsigned NOT NULL COMMENT '活动Id',
  `opty` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '1任务奖励2天奖励',
  `day` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '天数对应',
  `tasktype` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'gold后',
  `taskid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '抽奖后积分',
  `awards` varchar(200) NOT NULL DEFAULT '[]' COMMENT '奖励',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间戳',
  PRIMARY KEY (`id`),
  KEY act_id(`act_id`),
  KEY role_id(`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='全民动员领奖日志';


ALTER TABLE `mobilize_fake_cord`
ADD COLUMN `act`  int(11) NOT NULL DEFAULT 0 COMMENT '活动' AFTER `fake_id`,
ADD COLUMN `real_pro`  int(11) NOT NULL DEFAULT 0 COMMENT '真实进度' AFTER `process`;

CREATE TABLE `log_mobilize_progress` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `act` int(11) unsigned NOT NULL COMMENT '活动',
  `task_type` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '任务类型',
  `desc` varchar(200) NOT NULL DEFAULT '[]' COMMENT '描述',
  `fake` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '假数ID',
  `process` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '进度',
  `real_pro` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '真实进度',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间戳',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='全民动员进度日志';

ALTER TABLE `log_visus_upgrade`
ADD COLUMN `desc`  varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '描述' AFTER `condition`;

-- 魂力升级日志
drop table if exists log_uranium_upgrade;
CREATE TABLE `log_uranium_upgrade` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '角色名称',
  `befgrade` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '旧阶',
  `beflv` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '旧等级',
  `aftgrade` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '新阶',
  `aftlv` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '新等级',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='魂力升级日志';