-- 用户食物收藏表
CREATE TABLE IF NOT EXISTS `t_user_food_favorites` (
  `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `user_id` VARCHAR(255) NOT NULL COMMENT '用户ID',
  `food_id` BIGINT NOT NULL COMMENT '食物ID',
  `food_type` ENUM('system', 'custom') NOT NULL DEFAULT 'system' COMMENT '食物类型（system: 系统食物, custom: 用户自定义食物）',
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_user_food` (`user_id`, `food_id`, `food_type`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_food_id` (`food_id`),
  KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户食物收藏表';