37798-vm/db/migrations/002_add_services_quotes.sql
2026-01-25 11:21:00 +00:00

45 lines
2.2 KiB
SQL

CREATE TABLE IF NOT EXISTS services (
id INT AUTO_INCREMENT PRIMARY KEY,
title_ar VARCHAR(255) NOT NULL,
description_ar TEXT,
icon_class VARCHAR(50),
price_start DECIMAL(10,2) DEFAULT 0.00,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS quotes (
id INT AUTO_INCREMENT PRIMARY KEY,
service_id INT,
customer_name VARCHAR(255) NOT NULL,
customer_phone VARCHAR(50),
customer_email VARCHAR(255),
message TEXT,
status ENUM('new', 'contacted', 'closed') DEFAULT 'new',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Seed Services if empty
INSERT INTO services (title_ar, description_ar, icon_class, price_start)
SELECT * FROM (SELECT 'الشحن البحري', 'حلول شحن بحري موثوقة لمختلف الأحجام والحاويات (FCL/LCL) مع ضمان الوصول الآمن.', 'fa-ship', 500.00) AS tmp
WHERE NOT EXISTS (
SELECT title_ar FROM services WHERE title_ar = 'الشحن البحري'
) LIMIT 1;
INSERT INTO services (title_ar, description_ar, icon_class, price_start)
SELECT * FROM (SELECT 'الشحن الجوي', 'نقل جوي سريع وآمن للبضائع المستعجلة والقيمة لجميع مطارات العالم.', 'fa-plane', 1200.00) AS tmp
WHERE NOT EXISTS (
SELECT title_ar FROM services WHERE title_ar = 'الشحن الجوي'
) LIMIT 1;
INSERT INTO services (title_ar, description_ar, icon_class, price_start)
SELECT * FROM (SELECT 'التخزين واللوجستيات', 'مستودعات آمنة ومجهزة بأحدث أنظمة التتبع والإدارة للتحكم بالمخزون.', 'fa-warehouse', 200.00) AS tmp
WHERE NOT EXISTS (
SELECT title_ar FROM services WHERE title_ar = 'التخزين واللوجستيات'
) LIMIT 1;
INSERT INTO services (title_ar, description_ar, icon_class, price_start)
SELECT * FROM (SELECT 'التخليص الجمركي', 'فريق متخصص لإنهاء كافة الإجراءات الجمركية بسرعة وفعالية لضمان تدفق البضائع.', 'fa-file-signature', 150.00) AS tmp
WHERE NOT EXISTS (
SELECT title_ar FROM services WHERE title_ar = 'التخليص الجمركي'
) LIMIT 1;