Update: 2026-05-08 01:59:25

This commit is contained in:
Hamza-Ayed
2026-05-08 01:59:25 +03:00
parent 7528ec992d
commit 1cd511f12e
9 changed files with 507 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
-- Referral System Tables
CREATE TABLE IF NOT EXISTS referral_codes (
id CHAR(36) PRIMARY KEY,
user_id CHAR(36) NOT NULL,
tenant_id CHAR(36) NOT NULL,
code VARCHAR(20) NOT NULL UNIQUE,
is_active TINYINT(1) DEFAULT 1,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX idx_user (user_id),
INDEX idx_code (code),
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE IF NOT EXISTS referrals (
id CHAR(36) PRIMARY KEY,
referrer_id CHAR(36) NOT NULL,
referred_id CHAR(36) NULL,
referral_code VARCHAR(20) NOT NULL,
status ENUM('clicked', 'registered', 'subscribed') DEFAULT 'clicked',
reward_claimed TINYINT(1) DEFAULT 0,
reward_type VARCHAR(50) NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
converted_at TIMESTAMP NULL,
INDEX idx_referrer (referrer_id),
INDEX idx_code (referral_code),
FOREIGN KEY (referrer_id) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View File

@@ -0,0 +1,32 @@
-- Restore original Musadaq subscription pricing
-- Premium pricing justified by AI extraction + JoFotara + mobile app
UPDATE subscription_plans SET
name_ar = 'مجانية', name_en = 'Free',
max_companies = 1, max_invoices_month = 15, max_users = 1,
price_jod = 0.00, jofotara_enabled = 1
WHERE id = 'free';
UPDATE subscription_plans SET
name_ar = 'أساسية', name_en = 'Basic',
max_companies = 3, max_invoices_month = 100, max_users = 3,
price_jod = 15.00, jofotara_enabled = 1
WHERE id = 'basic';
UPDATE subscription_plans SET
name_ar = 'مكتبية', name_en = 'Office',
max_companies = 10, max_invoices_month = 500, max_users = 10,
price_jod = 45.00, jofotara_enabled = 1
WHERE id = 'office';
UPDATE subscription_plans SET
name_ar = 'احترافية', name_en = 'Pro',
max_companies = 25, max_invoices_month = 2000, max_users = 25,
price_jod = 99.00, jofotara_enabled = 1
WHERE id = 'pro';
UPDATE subscription_plans SET
name_ar = 'مؤسسية', name_en = 'Enterprise',
max_companies = 999, max_invoices_month = 99999, max_users = 999,
price_jod = 249.00, jofotara_enabled = 1
WHERE id = 'enterprise';