-- 1. Update existing plans to annual quotas and pricing -- We'll assume the basic plan ID is 'basic' and pro is 'pro'. If they are different, they will need adjusting. -- Basic Plan (Annual) UPDATE subscription_plans SET name_ar = 'الباقة الأساسية (سنوي)', name_en = 'Basic Plan (Annual)', price = 120.00, max_invoices_per_month = 12000, max_companies = 1, max_users = 1 WHERE id = 'basic'; -- Pro Plan (Annual) UPDATE subscription_plans SET name_ar = 'الباقة الاحترافية (سنوي)', name_en = 'Pro Plan (Annual)', price = 250.00, max_invoices_per_month = 50000, max_companies = 9999, -- unlimited max_users = 5 WHERE id = 'pro'; -- Free Trial Plan UPDATE subscription_plans SET name_ar = 'التجربة المجانية', name_en = 'Free Trial', price = 0.00, max_invoices_per_month = 15, max_companies = 1, max_users = 1 WHERE id = 'free'; -- 2. Update existing active subscriptions to match the new annual quota limits so no one gets blocked UPDATE subscriptions s JOIN subscription_plans sp ON s.plan_id = sp.id SET s.max_invoices_per_month = sp.max_invoices_per_month, s.max_companies = sp.max_companies, s.max_users = sp.max_users, -- Adjust the period end to +1 year if it's currently set to a month (for paid plans only) s.current_period_end = IF(s.plan_id != 'free', DATE_ADD(s.current_period_start, INTERVAL 1 YEAR), s.current_period_end);