ALTER TABLE `log_guild`
CHANGE COLUMN `extra` `cost`  varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '[]' COMMENT '消耗' AFTER `type`,
ADD COLUMN `guild_flag`  int(11) NOT NULL DEFAULT 0 COMMENT '社团标志' AFTER `guild_name`,
ADD COLUMN `guild_lv`  int(11) NOT NULL DEFAULT 0 COMMENT '社团等级' AFTER `guild_flag`,
ADD COLUMN `role_id`  bigint(20) NOT NULL DEFAULT 0 COMMENT '玩家ID' AFTER `guild_lv`,
ADD COLUMN `role_lv`  int(11) NOT NULL DEFAULT 0 COMMENT '玩家等级' AFTER `role_id`,
ADD COLUMN `role_vip`  int(11) NOT NULL DEFAULT 0 COMMENT '玩家VIP' AFTER `role_lv`;

ALTER TABLE `log_guild`
ADD COLUMN `role_name`  varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '[]' COMMENT '玩家名字' AFTER `role_id`;


CREATE TABLE `log_guild_rename` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `guild_id` bigint(20) unsigned DEFAULT NULL COMMENT '公会id',
  `role_id` bigint(20) unsigned NOT NULL COMMENT '玩家id',
  `role_name` varchar(50) NOT NULL COMMENT '玩家名',
  `old_name` varchar(50) NOT NULL COMMENT '原社团名',
  `new_name` varchar(50) NOT NULL COMMENT '新社团名',
  `old_flag` int(11) unsigned NOT NULL COMMENT '旧标志',
  `new_flag` int(11) unsigned NOT NULL COMMENT '新标志',
  `cost` varchar(50) NOT NULL COMMENT '花费',
  `time` int(11) unsigned NOT NULL COMMENT '时间',
  PRIMARY KEY (`id`),
  KEY `role_id` (`role_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='社团改名日志';

-- tyl宠物日志
CREATE TABLE `log_pet_grow` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `pet_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '宠物Id',
  `stars_bef` smallint(6) unsigned NOT NULL DEFAULT '0' COMMENT '培养前星数',
  `grade_bef` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '培养前等级',
  `exp_bef` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '培养前经验',
  `type` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '操作类型 1-激活 2喂养 3升阶 4觉醒',
  `stars_aft` smallint(6) unsigned NOT NULL DEFAULT '0' COMMENT '培养后星数',
  `grade_aft` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '培养后等级',
  `exp_aft` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '培养后经验',
  `cost` varchar(255) NOT NULL DEFAULT '[]' COMMENT '消耗',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`),
  KEY `role_id` (`role_id`) USING BTREE,
  KEY `pet_id` (`pet_id`) USING BTREE,
  KEY `type` (`type`) USING BTREE,
  KEY `time` (`time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='宠物养成日志表';

CREATE TABLE `log_pet_jewel` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `pet_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '宠物Id',
  `pos` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '操作位置 1构造 2律动 3原力 4灵能',
  `item_bef` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '操作前该位置物品Id',
  `item_aft` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '操作后该位置物品Id',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`),
  KEY `role_id` (`role_id`) USING BTREE,
  KEY `pet_id` (`pet_id`) USING BTREE,
  KEY `pos` (`pos`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='宠物宝石日志表';


CREATE TABLE `log_recharge_welfare`  (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) NOT NULL COMMENT '角色ID',
  `product_id` smallint(6) NOT NULL COMMENT '商品ID',
  `days` smallint(6) NOT NULL COMMENT '持续天数',
  `days_left` smallint(6) NOT NULL COMMENT '剩余可领天数',
  `award_list` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '奖励列表',
  `time` int(11) NOT NULL COMMENT '时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '尊享卡领奖日志' ROW_FORMAT = Dynamic;

-- 性格日志
CREATE TABLE `log_nature` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `epi` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '章节',
  `nature_type` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '性格分支',
  `nature_knot` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '性格节点',
  `light_time` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '点亮次数',
  `type` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '点亮消耗类型 1专项性格点 2自由性格点',
  `cost` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '消耗自由性格点',
  `cost_left` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '剩余自由性格点',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间戳',
  PRIMARY KEY (`id`),
  KEY `role_id` (`role_id`) USING BTREE,
  KEY `type` (`type`) USING BTREE,
  KEY `time` (`time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='性格点亮日志';

CREATE TABLE `log_nature_box` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `scene_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '场景Id',
  `box_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '宝箱怪Id',
  `nature_gain` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '获得自由点数',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`),
  KEY `role_id` (`role_id`) USING BTREE,
  KEY `scene_id` (`scene_id`) USING BTREE,
  KEY `box_id` (`box_id`) USING BTREE,
  KEY `time` (`time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='性格宝箱获取日志';

CREATE TABLE `log_nature_upgrade` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `lv_bef` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '突破前等级',
  `lv_aft` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '突破后等级',
  `cost` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '消耗自由点',
  `cost_left` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '剩余性格点',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
  PRIMARY KEY (`id`),
  KEY `role_id` (`role_id`) USING BTREE,
  KEY `time` (`time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='性格突破日志';


DROP TABLE IF EXISTS log_rename_guild;

CREATE TABLE `log_guild_lv` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `guild_id` bigint(20) unsigned DEFAULT NULL COMMENT '社团id',
  `guild_name` varchar(50) NOT NULL COMMENT '社团名',
  `chief_id` bigint(20) unsigned NOT NULL COMMENT '团长id',
  `chief_name` varchar(50) NOT NULL COMMENT '团长名',
  `old_lv` int(11) unsigned NOT NULL COMMENT '旧等级',
  `new_lv` int(11) unsigned NOT NULL COMMENT '新等级',
  `time` int(11) unsigned NOT NULL COMMENT '时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='社团等级日志';

CREATE TABLE `log_guild_merge` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `a_guild_id` bigint(20) unsigned DEFAULT NULL COMMENT '社团id',
  `a_guild_name` varchar(50) NOT NULL COMMENT '社团名',
  `a_chief_id` bigint(20) unsigned NOT NULL COMMENT '团长id',
  `a_chief_name` varchar(50) NOT NULL COMMENT '团长名',
  `a_num`  int(11) unsigned NOT NULL COMMENT '人数',
  `opty` int(11) unsigned NOT NULL COMMENT '操作类型',
  `b_guild_id` bigint(20) unsigned DEFAULT NULL COMMENT '对方社团id',
  `b_guild_name` varchar(50) NOT NULL COMMENT '对方社团名',
  `b_live` int(11) unsigned NOT NULL COMMENT '对方活跃',
  `b_num`  int(11) unsigned NOT NULL COMMENT '对方人数',
  `days` int(11) unsigned NOT NULL COMMENT '开服天数',
  `time` int(11) unsigned NOT NULL COMMENT '时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='社团合并日志';


CREATE TABLE `log_consume_gfame` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '消费时间',
  `consume_type` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '消费类型',
  `player_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色ID',
  `goods_id` bigint(20) unsigned DEFAULT '0' COMMENT '物品id',
  `goods_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '物品数量',
  `cost_gfame` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '消耗贡献',
  `remain_gfame` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '铜钱贡献',
  `about` text NOT NULL COMMENT '消费内容',
  `lv` smallint(6) unsigned NOT NULL DEFAULT '0' COMMENT '玩家等级',
  `vip_lv` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'vip等级',
  PRIMARY KEY (`id`),
  KEY `consume_type` (`consume_type`),
  KEY `player_id` (`player_id`),
  KEY `goods_id` (`goods_id`),
  KEY `lv` (`lv`),
  KEY `time` (`time`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='社团贡献消费日志';


CREATE TABLE `log_produce_gfame` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '生产时间',
  `produce_type` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '生产类型',
  `player_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色ID',
  `lv` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '角色等级',
  `vip_lv` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'vip等级',
  `got_gfame` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '生产贡献',
  `remain_gfame` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '贡献余额',
  `about` text NOT NULL COMMENT '生产内容',
  PRIMARY KEY (`id`),
  KEY `produce_type` (`produce_type`) USING BTREE,
  KEY `player_id` (`player_id`) USING BTREE,
  KEY `time` (`time`) USING BTREE
) ENGINE=InnoDB  AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='贡献生产日志';

CREATE TABLE `log_guild_lives_award` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `guild_id` bigint(20) unsigned DEFAULT NULL COMMENT '社团id',
  `guild_name` varchar(50) NOT NULL COMMENT '社团名',
  `role_id` bigint(20) unsigned NOT NULL COMMENT '玩家id',
  `role_name` varchar(50) NOT NULL COMMENT '玩家名',
  `total_live` int(11) unsigned NOT NULL COMMENT '活跃值',
  `need_live` int(11) unsigned NOT NULL COMMENT '活跃值需求',
  `awards` varchar(50) NOT NULL COMMENT '奖励',
  `time` int(11) unsigned NOT NULL COMMENT '时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='社团活跃奖励领取日志';


CREATE TABLE `log_guild_order` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `guild_id` bigint(20) unsigned DEFAULT NULL COMMENT '社团id',
  `guild_name` varchar(50) NOT NULL COMMENT '社团名',
  `role_id` bigint(20) unsigned NOT NULL COMMENT '玩家id',
  `role_name` varchar(50) NOT NULL COMMENT '玩家名',
  `opty` int(11) unsigned NOT NULL COMMENT '操作类型0完成1发起感谢',
  `order_id` int(11) unsigned NOT NULL COMMENT '订单ID',
  `order_color` int(11) unsigned NOT NULL COMMENT '订单品质',
  `order_num` int(11) unsigned NOT NULL COMMENT '订单人数需求',
  `roles` varchar(500) NOT NULL COMMENT '参与人',
  `awards` varchar(100) NOT NULL COMMENT '奖励',
  `time` int(11) unsigned NOT NULL COMMENT '时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='社团派单日志';

CREATE TABLE `log_charge_goods`  (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'id',
  `role_id` bigint(20) NOT NULL COMMENT '角色ID',
  `product_id` smallint(6) NOT NULL COMMENT '商品ID',
  `type` smallint(6) NOT NULL COMMENT '商品大类',
  `sub_type` smallint(6) NOT NULL COMMENT '商品子类',
	`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '商品名称',
	`recharge_total` smallint(6) NOT NULL COMMENT '累计充值金额（计算金额而不是彩钻）',
	`level` smallint(6) NOT NULL COMMENT '玩家等级',
	`vip` smallint(6) NOT NULL COMMENT 'vip等级',
  `time` int(11) NOT NULL COMMENT '时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '充值商品购买日志' ROW_FORMAT = Dynamic;