-- ******************************************************************
-- 表 kku_pet_battle_team_members 的创建SQL
-- 对应的Model: App\Module\Pet\Models\PetBattleTeamMember
-- 警告: 此文件由系统自动生成，禁止修改！
-- ******************************************************************

CREATE TABLE `kku_pet_battle_team_members` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `team_id` int(10) unsigned NOT NULL COMMENT '队伍ID',
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID',
  `pet_id` bigint(20) unsigned NOT NULL COMMENT '宠物ID',
  `power` int(10) unsigned NOT NULL COMMENT '战力贡献',
  `join_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `idx_team_user` (`team_id`,`user_id`) USING BTREE,
  KEY `idx_pet` (`pet_id`) USING BTREE,
  CONSTRAINT `kku_pet_battle_team_members_ibfk_1` FOREIGN KEY (`team_id`) REFERENCES `kku_pet_battle_teams` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `kku_pet_battle_team_members_ibfk_2` FOREIGN KEY (`pet_id`) REFERENCES `kku_pet_users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='争霸赛队伍成员';
