-- tyl
-- 宠物系统

CREATE TABLE IF NOT EXISTS `role_child` (
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `child_name` varchar(255) NOT NULL DEFAULT '' COMMENT '孩子名称',
  `child_sex` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '孩子性别',
  `child_age_year` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '孩子年龄-年',
  `child_age_month` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '孩子年龄-月',
  `child_age_exp` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '孩子成长进度(经验值)',
  `heart_link_level` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '同心等级',
  `heart_link_exp` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '同心经验值',
  `vote_times` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '当天点赞次数',
  `be_voted_count` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '被点赞次数',
  PRIMARY KEY (`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='孩子基础信息表';

CREATE TABLE IF NOT EXISTS `child_daily_task` (
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `sequence` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '任务序列',
  `task_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '任务类型',
  `task_id` varchar(255) NOT NULL DEFAULT '[]' COMMENT '任务Id(列表格式)',
  `progress` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '进度',
  `task_state` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '任务状态(0-未完成 1-已完成未领取 2-已领取)',
  PRIMARY KEY (`role_id`,`sequence`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='孩子每日任务数据表';

CREATE TABLE IF NOT EXISTS `child_be_voted_log` (
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `vote_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '点赞者id',
  `vote_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '点赞时间戳',
  `feed_back_status` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '回赞状态(0-未回赞 1-已回赞)',
  PRIMARY KEY (`role_id`,`vote_id`,`vote_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='孩子点赞记录表';

CREATE TABLE IF NOT EXISTS `child_vote_rank` (
  `rank` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '排名',
  `role_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '角色Id',
  `child_name` varchar(255) NOT NULL DEFAULT '' COMMENT '孩子名称',
  `be_voted_count` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '点赞次数',
  PRIMARY KEY (`rank`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='孩子点赞排行榜数据表';
