Update: 2026-05-05 00:12:11
This commit is contained in:
@@ -42,9 +42,12 @@ $migrations = [
|
||||
sort_order INT DEFAULT 0,
|
||||
features_json JSON NULL,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
",
|
||||
|
||||
// 4.5 Fix collation if table already exists
|
||||
'subscription_plans_collation_fix' => "ALTER TABLE subscription_plans CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci",
|
||||
|
||||
// 5. Ensure subscriptions table exists with all needed columns
|
||||
'subscriptions_table' => "
|
||||
CREATE TABLE IF NOT EXISTS subscriptions (
|
||||
@@ -64,9 +67,12 @@ $migrations = [
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (plan_id) REFERENCES subscription_plans(id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
",
|
||||
|
||||
// 5.5 Fix collation if table already exists
|
||||
'subscriptions_collation_fix' => "ALTER TABLE subscriptions CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci",
|
||||
|
||||
// 6. Add plan_id column to subscriptions if upgrading from old schema
|
||||
'subscriptions_plan_id' => "ALTER TABLE subscriptions ADD COLUMN plan_id VARCHAR(20) NOT NULL DEFAULT 'free'",
|
||||
|
||||
@@ -108,8 +114,8 @@ echo "\n────────────────────────
|
||||
echo "\n📦 Seeding subscription plans...\n";
|
||||
|
||||
$plans = [
|
||||
['free', 'مجانية', 'Free', 1, 15, 1, 0.00, 0, 0, 10],
|
||||
['basic', 'أساسية', 'Basic', 3, 100, 3, 15.00, 1, 0, 20],
|
||||
['free', 'مجانية', 'Free', 1, 15, 1, 0.00, 1, 1, 10],
|
||||
['basic', 'أساسية', 'Basic', 3, 100, 3, 15.00, 1, 1, 20],
|
||||
['office', 'مكتبية', 'Office', 10, 500, 10, 45.00, 1, 1, 30],
|
||||
['pro', 'احترافية', 'Pro', 25, 2000, 25, 99.00, 1, 1, 40],
|
||||
['enterprise', 'مؤسسية', 'Enterprise', 999, 99999, 999, 249.00, 1, 1, 50],
|
||||
|
||||
Reference in New Issue
Block a user