-- Add JSON field for dynamic custom activities
-- This allows n8n to add/remove activity types without schema changes

ALTER TABLE activity_status 
ADD COLUMN IF NOT EXISTS custom_activities JSONB DEFAULT '{}';

-- Comment explaining the structure
COMMENT ON COLUMN activity_status.custom_activities IS 
'Dynamic activity types added via n8n. Example:
{
  "reading": {
    "enabled": true,
    "book_title": "Clean Code",
    "author": "Robert C. Martin",
    "progress": 65,
    "platform": "hardcover"
  },
  "working_out": {
    "enabled": true,
    "activity": "Running",
    "duration": 45,
    "calories": 350
  }
}';

-- Create index for faster JSONB queries
CREATE INDEX IF NOT EXISTS idx_activity_custom_activities ON activity_status USING gin(custom_activities);
