-- 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;