Update: 2026-05-16 00:27:57

This commit is contained in:
Hamza-Ayed
2026-05-16 00:27:59 +03:00
parent e93f1d4f34
commit 663896becb

View File

@@ -1,46 +1,41 @@
-- 1. Update existing plans to annual quotas and pricing -- 1. تحديث الباقات الحالية إلى باقات سنوية بالأسعار والأرقام الجديدة
-- 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 UPDATE subscription_plans
SET SET
name_ar = 'الباقة الأساسية (سنوي)', name_ar = 'الباقة الأساسية (سنوي)',
name_en = 'Basic Plan (Annual)', name_en = 'Basic Plan (Annual)',
price = 120.00, price_jod = 120.00,
max_invoices_per_month = 12000, max_invoices_month = 12000,
max_companies = 1, max_companies = 1,
max_users = 1 max_users = 1
WHERE id = 'basic'; WHERE id = 'basic';
-- Pro Plan (Annual)
UPDATE subscription_plans UPDATE subscription_plans
SET SET
name_ar = 'الباقة الاحترافية (سنوي)', name_ar = 'الباقة الاحترافية (سنوي)',
name_en = 'Pro Plan (Annual)', name_en = 'Pro Plan (Annual)',
price = 250.00, price_jod = 250.00,
max_invoices_per_month = 50000, max_invoices_month = 50000,
max_companies = 9999, -- unlimited max_companies = 9999, -- للشركات غير المحدودة
max_users = 5 max_users = 5
WHERE id = 'pro'; WHERE id = 'pro';
-- Free Trial Plan -- 2. إبقاء الباقة المجانية كما هي
UPDATE subscription_plans UPDATE subscription_plans
SET SET
name_ar = 'التجربة المجانية', name_ar = 'التجربة المجانية',
name_en = 'Free Trial', name_en = 'Free Trial',
price = 0.00, price_jod = 0.00,
max_invoices_per_month = 15, max_invoices_month = 15,
max_companies = 1, max_companies = 1,
max_users = 1 max_users = 1
WHERE id = 'free'; WHERE id = 'free';
-- 2. Update existing active subscriptions to match the new annual quota limits so no one gets blocked -- 3. ترحيل وتحديث بيانات العملاء المشتركين حالياً
UPDATE subscriptions s UPDATE subscriptions s
JOIN subscription_plans sp ON s.plan_id = sp.id JOIN subscription_plans sp ON s.plan_id = sp.id
SET SET
s.max_invoices_per_month = sp.max_invoices_per_month, s.max_invoices_per_month = sp.max_invoices_month,
s.max_companies = sp.max_companies, s.max_companies = sp.max_companies,
s.max_users = sp.max_users, 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); s.current_period_end = IF(s.plan_id != 'free', DATE_ADD(s.current_period_start, INTERVAL 1 YEAR), s.current_period_end);