-- 2020-07-06 10:00
-- 陪玩游戏配置表
CREATE TABLE `friendship`.`play_game_config`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `game_cover` varchar(256) NULL COMMENT '游戏封面',
  `game_name` varchar(16) NULL COMMENT '游戏名称',
  `create_time` timestamp(0) NULL COMMENT '创建时间',
  `status` tinyint(2) NULL COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 10001000 COMMENT = '系统技能游戏配置表';

-- 陪玩师注册表
CREATE TABLE `friendship`.`play_user_registered`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_id` bigint(20) NULL COMMENT '用户id',
  `game_id` bigint(10) NULL COMMENT '认证的游戏id',
  `user_game_screen_shot` varchar(256) NULL COMMENT '用户游戏段位截图',
  `user_game_level` varchar(32) NULL COMMENT '用户游戏段位',
  `user_game_image_status` tinyint(2) NULL COMMENT '用户本人形象资料审核状态',
  `create_time` timestamp(0) NULL COMMENT '申请时间',
  `update_time` timestamp(0) NULL COMMENT '更新时间',
  `verify_status` tinyint(2) NULL COMMENT '审核状态',
  `service_status` tinyint(2) NULL COMMENT '服务状态(接单中/暂停接单)',
  `service_title` varchar(32) NULL COMMENT '服务标题',
  `price` integer(10) NULL COMMENT '游戏价格/局',
  `game_cover` varchar(255) NULL COMMENT '技能封面图',
  PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 10001001 COMMENT = '陪玩师认证信息表';

-- 陪玩订单表
CREATE TABLE `friendship`.`play_orders`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_id` bigint(20) NULL COMMENT '用户id',
  `game_id` bigint(10) NULL COMMENT '陪玩的游戏id',
  `play_user_id` bigint(20) NULL COMMENT '陪玩师id',
  `service_start_time` timestamp(0) NULL COMMENT '陪玩开始时间',
  `service_end_time` timestamp(0) NULL COMMENT '陪玩结束时间',
  `number_of_board` int(4) NULL COMMENT '游戏局数',
  `ramark` varchar(128) NULL COMMENT '备注信息',
  `total_beans` int(10) NULL COMMENT '所需U豆数',
  `status` tinyint(2) NULL COMMENT '订单状态',
  PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 10001100 COMMENT = '陪玩订单表';

-- 陪玩用户形象卡
CREATE TABLE `friendship`.`play_user_image_card`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '形象卡id',
  `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id',
  `status` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
  `type` tinyint(4) NULL DEFAULT NULL COMMENT '类型',
  `create_time` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间',
  `verify_date` timestamp(0) NULL DEFAULT NULL COMMENT '审核时间',
  `verify_user_id` bigint(20) NULL DEFAULT NULL COMMENT '审核人id',
  `update_time` timestamp(0) NULL DEFAULT NULL COMMENT '更新时间',
  `is_fill` tinyint(2) NULL DEFAULT 0 COMMENT '视频是否撑满全屏',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_user_id`(`user_id`, `id`, `type`, `is_fill`) USING BTREE COMMENT '用户id创建索引'
) ENGINE = InnoDB AUTO_INCREMENT = 100100540 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '陪玩用户形象卡数据表\n' ROW_FORMAT = Dynamic;

-- 陪玩用户图片形象卡
CREATE TABLE `friendship`.`play_user_image_card_pictures`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `image_card_id` bigint(20) NOT NULL COMMENT '形象卡id',
  `user_id` bigint(20) NOT NULL COMMENT '用户id',
  `src` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'url地址',
  `status` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
  `create_time` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间',
  `seq` int(10) NULL DEFAULT NULL COMMENT '序号',
  `verify_date` timestamp(0) NULL DEFAULT NULL COMMENT '审核时间',
  `verify_user_id` bigint(20) NULL DEFAULT NULL COMMENT '审核人id',
  `update_time` timestamp(0) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `userIdSeq`(`user_id`, `seq`) USING BTREE COMMENT '用户id序号创建索引'
) ENGINE = InnoDB AUTO_INCREMENT = 350 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '陪玩用户形象卡照片数据表\n' ROW_FORMAT = Dynamic;

-- 陪玩用户视频形象卡
CREATE TABLE `friendship`.`play_user_image_card_video`  (
  `image_card_id` bigint(20) NOT NULL COMMENT '形象卡id',
  `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id',
  `src` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址',
  `status` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
  `create_time` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间',
  `seq` int(10) NULL DEFAULT NULL COMMENT '序号',
  `cover_image_src` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '封面地址',
  `verify_date` timestamp(0) NULL DEFAULT NULL COMMENT '审核时间',
  `verify_user_id` bigint(20) NULL DEFAULT NULL COMMENT '审核人id',
  `update_time` timestamp(0) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`image_card_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '陪玩用户视频形象卡' ROW_FORMAT = Dynamic;

-- 房间信息
CREATE TABLE `friendship`.`live_room`  (
  `id` bigint(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_id` bigint(20) NULL COMMENT '用户',
  `room_id` bigint(20) NULL COMMENT '房间号',
  `room_title` varchar(126) NULL COMMENT '房间标题',
  `recommended_location` tinyint(2) NULL COMMENT '房间推荐位置',
  `live_status` tinyint(2) NULL COMMENT '直播状态',
  `create_time` timestamp(0) NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE = InnoDB AUTO_INCREMENT = 10001000 COMMENT = '房间信息';