- 数据库新增 type 列区分 water/exercise/diet/mood/sleep/weight 六类挑战 - 进度上报由增量模式改为绝对值模式,字段 increment_value → reportedValue - 服务层按 challenge.targetValue 判断当日是否完成,再按 minimumCheckInDays 统计总进度 - 相关 DTO 与模型同步更新,支持新类型返回 BREAKING CHANGE: 上报接口字段由 increment 改为 value,且为当日绝对值
14 lines
553 B
SQL
14 lines
553 B
SQL
-- Add challenge type column to t_challenges table
|
|
-- This migration adds the type column to support different challenge types
|
|
|
|
ALTER TABLE t_challenges
|
|
ADD COLUMN type ENUM('water', 'exercise', 'diet', 'mood', 'sleep', 'weight')
|
|
NOT NULL DEFAULT 'water'
|
|
COMMENT '挑战类型'
|
|
AFTER cta_label;
|
|
|
|
-- Create index on type column for better query performance
|
|
CREATE INDEX idx_challenges_type ON t_challenges (type);
|
|
|
|
-- Update existing challenges to have 'water' type if they don't have a type
|
|
UPDATE t_challenges SET type = 'water' WHERE type IS NULL; |