-- Update subscription plan features to include file upload limits
-- Run this in phpMyAdmin

UPDATE subscription_plans 
SET features = '{"features": ["5 messages per day", "3 file uploads per day", "Basic AI responses", "Community support"]}'
WHERE slug = 'free';

UPDATE subscription_plans 
SET features = '{"features": ["100 messages per day", "20 file uploads per day", "Enhanced AI responses", "Email support"]}'
WHERE slug = 'silver';

UPDATE subscription_plans 
SET features = '{"features": ["500 messages per day", "50 file uploads per day", "Advanced AI responses", "Priority email support", "API access"]}'
WHERE slug = 'gold';

UPDATE subscription_plans 
SET features = '{"features": ["Unlimited messages", "Unlimited file uploads", "Premium AI responses", "24/7 Priority support", "Full API access", "Custom integrations"]}'
WHERE slug = 'premium';

-- Also update the file_upload_limit column if it exists
UPDATE subscription_plans SET file_upload_limit = 3 WHERE slug = 'free';
UPDATE subscription_plans SET file_upload_limit = 20 WHERE slug = 'silver';
UPDATE subscription_plans SET file_upload_limit = 50 WHERE slug = 'gold';
UPDATE subscription_plans SET file_upload_limit = NULL WHERE slug = 'premium';

-- Make sure all plans are active
UPDATE subscription_plans SET is_active = 1 WHERE is_active IS NULL OR is_active = 0;

-- Set sort order if not set
UPDATE subscription_plans SET sort_order = 1 WHERE slug = 'free' AND (sort_order IS NULL OR sort_order = 0);
UPDATE subscription_plans SET sort_order = 2 WHERE slug = 'silver' AND (sort_order IS NULL OR sort_order = 0);
UPDATE subscription_plans SET sort_order = 3 WHERE slug = 'gold' AND (sort_order IS NULL OR sort_order = 0);
UPDATE subscription_plans SET sort_order = 4 WHERE slug = 'premium' AND (sort_order IS NULL OR sort_order = 0);
