-- 命名方案收藏表
CREATE TABLE `yifan_naming_favorites` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `uuid` varchar(64) NOT NULL COMMENT 'UUID全局唯一标识',
  `status` varchar(10) NOT NULL DEFAULT '0' COMMENT '是否启用(0:启用 1:禁用)',
  `description` text DEFAULT NULL COMMENT '备注/描述',
  `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `created_id` int(11) DEFAULT NULL COMMENT '创建人ID',
  `updated_id` int(11) DEFAULT NULL COMMENT '更新人ID',
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除(0否 1是)',
  
  `user_id` int(11) NOT NULL COMMENT '用户ID',
  `solution_id` int(11) NOT NULL COMMENT '方案ID(关联yifan_naming_solutions表)',
  `report_id` int(11) NOT NULL COMMENT '报告ID(关联yifan_naming_reports表)',
  `category` varchar(20) NOT NULL DEFAULT 'personal' COMMENT '分类(personal:个人 company:商号)',
  `remark` varchar(255) DEFAULT NULL COMMENT '备注',
  
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_uuid` (`uuid`),
  UNIQUE KEY `uk_user_solution` (`user_id`, `solution_id`) COMMENT '用户-方案唯一索引',
  KEY `idx_user_id` (`user_id`),
  KEY `idx_solution_id` (`solution_id`),
  KEY `idx_report_id` (`report_id`),
  KEY `idx_category` (`category`),
  KEY `idx_created_time` (`created_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='命名方案收藏表';
