Files
musadaq-saas/update_subscription_strategy.sql
2026-05-16 01:36:22 +03:00

47 lines
1.6 KiB
SQL

-- 1. إضافة أعمدة الأسعار (شهري وسنوي) وجدولة الفواتير
ALTER TABLE subscription_plans
ADD COLUMN price_annual_jod DECIMAL(10,2) DEFAULT 0.00 AFTER price_jod,
ADD COLUMN price_monthly_jod DECIMAL(10,2) DEFAULT 0.00 AFTER price_annual_jod;
-- 2. إضافة دورة الفوترة لجدول الاشتراكات وطلبات الدفع
ALTER TABLE subscriptions
ADD COLUMN billing_cycle ENUM('monthly', 'annual') DEFAULT 'annual' AFTER status;
ALTER TABLE payment_requests
ADD COLUMN billing_cycle ENUM('monthly', 'annual') DEFAULT 'annual' AFTER plan_id;
-- 3. تحديث الباقات بالقيم الجديدة المقترحة في التحليل الاستراتيجي
-- الباقة الأساسية
UPDATE subscription_plans
SET
name_ar = 'الباقة الأساسية',
price_annual_jod = 120.00,
price_monthly_jod = 15.00,
max_invoices_month = 500, -- تم تخفيضها من 12000 للتحويل المستقبلي
max_companies = 3, -- تم زيادتها من 1 لجذب المحاسبين المستقلين
max_users = 2,
is_active = 1
WHERE id = 'basic';
-- الباقة الاحترافية
UPDATE subscription_plans
SET
name_ar = 'الباقة الاحترافية',
price_annual_jod = 290.00,
price_monthly_jod = 35.00,
max_invoices_month = 3000,
max_companies = 9999,
max_users = 5,
is_active = 1
WHERE id = 'pro';
-- الباقة المجانية
UPDATE subscription_plans
SET
price_annual_jod = 0.00,
price_monthly_jod = 0.00,
max_invoices_month = 15,
max_companies = 1,
max_users = 1
WHERE id = 'free';