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

CREATE TABLE `kku_activity_participation` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `activity_id` bigint NOT NULL COMMENT '活动ID',
  `participate_time` datetime NOT NULL COMMENT '参与时间',
  `reward_status` tinyint DEFAULT '0' COMMENT '奖励状态',
  `completion_status` tinyint DEFAULT '0' COMMENT '完成状态',
  `completion_time` datetime DEFAULT NULL COMMENT '完成时间',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `idx_user_id` (`user_id`) USING BTREE,
  KEY `idx_activity_id` (`activity_id`) USING BTREE,
  KEY `idx_user_activity` (`user_id`,`activity_id`) USING BTREE,
  KEY `idx_activity_reward` (`activity_id`,`reward_status`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='活动参与记录表';
