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

CREATE TABLE `kku_activity_condition` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `activity_id` bigint(20) NOT NULL COMMENT '关联活动ID',
  `condition_type` tinyint(4) NOT NULL COMMENT '条件类型',
  `condition_params` json NOT NULL COMMENT '条件参数',
  `is_participation_condition` tinyint(4) DEFAULT '0' COMMENT '是否为参与条件',
  `is_completion_condition` tinyint(4) DEFAULT '0' COMMENT '是否为完成条件',
  `display_order` int(11) DEFAULT '0' 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_activity_id` (`activity_id`) USING BTREE,
  KEY `idx_activity_type` (`activity_id`,`condition_type`) USING BTREE,
  KEY `idx_participation` (`activity_id`,`is_participation_condition`) USING BTREE,
  KEY `idx_completion` (`activity_id`,`is_completion_condition`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='活动条件表';
