Update: 2026-06-30 22:43:38

This commit is contained in:
Hamza-Ayed
2026-06-30 22:43:38 +03:00
parent 1b5d6eae44
commit 26ae0124c8
4 changed files with 351 additions and 0 deletions

View File

@@ -1972,3 +1972,82 @@ CREATE TABLE IF NOT EXISTS `scraped_competitor_prices` (
KEY `idx_start_location` (`start_location`),
KEY `idx_country_code` (`country_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- Location Intelligence Engine Schema Migrations
-- 1. Create table for Geofence Zones
CREATE TABLE IF NOT EXISTS `geofence_zones` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`zone_name` VARCHAR(255) NOT NULL,
`latitude` DECIMAL(10, 8) NOT NULL,
`longitude` DECIMAL(11, 8) NOT NULL,
`radius_meters` INT NOT NULL DEFAULT 2000,
`priority` INT DEFAULT 1,
`is_active` BOOLEAN DEFAULT TRUE,
`country_code` VARCHAR(2) DEFAULT 'JO',
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- 2. Alter passenger_opening_locations to support source tracking
-- Note: 'source' allows tracking if the location update came from app usage, a geofence trigger, or a silent push
ALTER TABLE `passenger_opening_locations`
ADD COLUMN `source` ENUM('app_usage', 'geofence', 'silent_push') DEFAULT 'app_usage',
ADD COLUMN `battery_level` INT DEFAULT NULL;
-- 3. Insert specific zones for testing and real usage (Jordan, Syria, Egypt)
INSERT INTO `geofence_zones` (`zone_name`, `latitude`, `longitude`, `radius_meters`, `priority`, `country_code`)
VALUES
-- Jordan (Amman) - 15 Zones
('Queen Alia International Airport', 31.7225, 35.9933, 3000, 10, 'JO'),
('Abdali Boulevard', 31.9631, 35.9122, 1000, 5, 'JO'),
('University of Jordan', 32.0129, 35.8741, 1500, 8, 'JO'),
('Taj Mall', 31.9427, 35.8895, 1000, 7, 'JO'),
('City Mall', 31.9749, 35.8362, 1000, 7, 'JO'),
('Mecca Mall', 31.9765, 35.8427, 1000, 7, 'JO'),
('Al Hussein Public Parks', 31.9868, 35.8286, 2000, 6, 'JO'),
('Amman Citadel', 31.9544, 35.9355, 1500, 6, 'JO'),
('Roman Theater', 31.9516, 35.9394, 1000, 6, 'JO'),
('Rainbow Street', 31.9497, 35.9231, 1000, 8, 'JO'),
('Jordan Hospital', 31.9612, 35.9039, 1000, 5, 'JO'),
('King Hussein Business Park', 31.9723, 35.8277, 1500, 8, 'JO'),
('Royal Automobile Museum', 31.9833, 35.8242, 1000, 4, 'JO'),
('Galleria Mall', 31.9542, 35.8564, 1000, 7, 'JO'),
('Sweifieh Village', 31.9515, 35.8519, 1000, 8, 'JO'),
-- Syria (Damascus) - 15 Zones
('Damascus International Airport', 33.4114, 36.5147, 3000, 10, 'SY'),
('Umayyad Mosque', 33.5116, 36.3067, 1000, 9, 'SY'),
('Al-Hamidiyah Souq', 33.5106, 36.3023, 1000, 8, 'SY'),
('Cham City Center', 33.5186, 36.2737, 1000, 7, 'SY'),
('Damascus University', 33.5103, 36.2894, 1500, 8, 'SY'),
('Mount Qasioun', 33.5350, 36.2750, 2000, 6, 'SY'),
('Al-Jalaa Sports Hall', 33.5133, 36.2625, 1500, 5, 'SY'),
('Dama Rose Hotel', 33.5150, 36.2870, 1000, 7, 'SY'),
('National Museum of Damascus', 33.5115, 36.2905, 1000, 6, 'SY'),
('Bab Tuma', 33.5126, 36.3150, 1000, 8, 'SY'),
('Malki Park', 33.5230, 36.2830, 1000, 6, 'SY'),
('Al-Assad University Hospital', 33.5042, 36.2575, 1500, 7, 'SY'),
('Al-Jalaa Street', 33.5145, 36.2645, 1000, 7, 'SY'),
('Mezzeh 86', 33.5020, 36.2420, 2000, 5, 'SY'),
('Baramkeh Bus Station', 33.5065, 36.2890, 1500, 8, 'SY'),
-- Egypt (Cairo) - 20 Zones
('Cairo International Airport', 30.1219, 31.4056, 3000, 10, 'EG'),
('The Egyptian Museum', 30.0478, 31.2336, 1000, 9, 'EG'),
('Cairo Tower', 30.0459, 31.2243, 1000, 8, 'EG'),
('Al-Azhar Park', 30.0405, 31.2643, 1500, 7, 'EG'),
('Khan el-Khalili', 30.0477, 31.2621, 1000, 8, 'EG'),
('Cairo University', 30.0276, 31.2101, 2000, 8, 'EG'),
('Mall of Arabia', 30.0075, 30.9734, 2000, 8, 'EG'),
('City Stars Mall', 30.0734, 31.3304, 2000, 9, 'EG'),
('Cairo Festival City Mall', 30.0305, 31.4061, 2000, 9, 'EG'),
('Giza Pyramids Entrance', 29.9792, 31.1342, 3000, 10, 'EG'),
('Smart Village', 30.0760, 30.0150, 2500, 7, 'EG'),
('Al-Ahly Club Gezira', 30.0440, 31.2230, 1000, 7, 'EG'),
('Zamalek', 30.0626, 31.2166, 2000, 8, 'EG'),
('Tahrir Square', 30.0444, 31.2357, 1500, 9, 'EG'),
('Heliopolis Korba', 30.0880, 31.3260, 1500, 7, 'EG'),
('Nasr City Abbas El Akkad', 30.0592, 31.3392, 2000, 8, 'EG'),
('Maadi Street 9', 29.9602, 31.2585, 1500, 8, 'EG'),
('Mall of Egypt', 29.9705, 30.9856, 2000, 9, 'EG'),
('Cairo Opera House', 30.0427, 31.2238, 1000, 7, 'EG'),
('Al-Azhar Mosque', 30.0457, 31.2627, 1000, 6, 'EG');