Update: 2026-06-21 18:58:05
This commit is contained in:
@@ -1125,12 +1125,54 @@ CREATE TABLE `passenger_opening_locations` (
|
||||
`passenger_id` varchar(100) NOT NULL,
|
||||
`latitude` varchar(30) NOT NULL,
|
||||
`longitude` varchar(30) NOT NULL,
|
||||
`country_code` varchar(5) NOT NULL DEFAULT 'SY',
|
||||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`location_point` point NOT NULL /*!80003 SRID 4326 */,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_passenger_id` (`passenger_id`)
|
||||
KEY `idx_passenger_id` (`passenger_id`),
|
||||
KEY `idx_country` (`country_code`),
|
||||
SPATIAL KEY `idx_location_point` (`location_point`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
||||
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||
/*!50003 SET character_set_client = utf8mb4 */ ;
|
||||
/*!50003 SET character_set_results = utf8mb4 */ ;
|
||||
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
|
||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||
/*!50003 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' */ ;
|
||||
DELIMITER ;;
|
||||
/*!50003 CREATE*/ /*!50017 DEFINER=`siroUserDB1`@`%`*/ /*!50003 TRIGGER `trg_before_insert_passenger_opening_locations` BEFORE INSERT ON `passenger_opening_locations` FOR EACH ROW BEGIN
|
||||
SET NEW.location_point = ST_PointFromText(CONCAT('POINT(', NEW.longitude, ' ', NEW.latitude, ')'), 4326);
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
||||
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
||||
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
||||
|
||||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
||||
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||
/*!50003 SET character_set_client = utf8mb4 */ ;
|
||||
/*!50003 SET character_set_results = utf8mb4 */ ;
|
||||
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
|
||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||
/*!50003 SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO' */ ;
|
||||
DELIMITER ;;
|
||||
/*!50003 CREATE*/ /*!50017 DEFINER=`siroUserDB1`@`%`*/ /*!50003 TRIGGER `trg_before_update_passenger_opening_locations` BEFORE UPDATE ON `passenger_opening_locations` FOR EACH ROW BEGIN
|
||||
IF NEW.latitude <> OLD.latitude OR NEW.longitude <> OLD.longitude THEN
|
||||
SET NEW.location_point = ST_PointFromText(CONCAT('POINT(', NEW.longitude, ' ', NEW.latitude, ')'), 4326);
|
||||
END IF;
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
/*!50003 SET character_set_client = @saved_cs_client */ ;
|
||||
/*!50003 SET character_set_results = @saved_cs_results */ ;
|
||||
/*!50003 SET collation_connection = @saved_col_connection */ ;
|
||||
|
||||
--
|
||||
-- Table structure for table `passengers`
|
||||
--
|
||||
@@ -1302,10 +1344,11 @@ CREATE TABLE `promos` (
|
||||
`amount` varchar(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0',
|
||||
`description` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
||||
`passengerID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'none',
|
||||
`source` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'manual',
|
||||
`validity_start_date` date DEFAULT NULL,
|
||||
`validity_end_date` date DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `passengerID` (`passengerID`)
|
||||
KEY `passengerID` (`passengerID`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=637 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
@@ -1813,3 +1856,72 @@ CREATE TABLE IF NOT EXISTS `driver_cash_claims` (
|
||||
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
--
|
||||
-- Table structure for table `competitor_prices`
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `competitor_prices` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`competitor_name` varchar(50) NOT NULL,
|
||||
`from_latitude` varchar(30) NOT NULL,
|
||||
`from_longitude` varchar(30) NOT NULL,
|
||||
`to_latitude` varchar(30) NOT NULL,
|
||||
`to_longitude` varchar(30) NOT NULL,
|
||||
`distance_km` decimal(8,2) NOT NULL,
|
||||
`total_price` decimal(10,2) NOT NULL,
|
||||
`price_per_km` decimal(8,2) NOT NULL,
|
||||
`country_code` varchar(5) NOT NULL DEFAULT 'SY',
|
||||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_competitor_country` (`competitor_name`, `country_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
--
|
||||
-- Table structure for table `marketing_campaigns_log`
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `marketing_campaigns_log` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`passenger_id` varchar(100) NOT NULL,
|
||||
`message_type` enum('sms','whatsapp','push') NOT NULL,
|
||||
`country_code` varchar(5) NOT NULL,
|
||||
`region_name` varchar(100) DEFAULT NULL,
|
||||
`triggered_by` enum('anomaly','manual','autopilot') NOT NULL DEFAULT 'autopilot',
|
||||
`sent_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`opened_app_after` tinyint(1) DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_passenger_date` (`passenger_id`, `sent_at`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
--
|
||||
-- Table structure for table `price_anomalies`
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `price_anomalies` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`country_code` varchar(5) NOT NULL,
|
||||
`region_name` varchar(100) NOT NULL,
|
||||
`anomaly_type` enum('surge','undercut','opportunity') NOT NULL,
|
||||
`competitor_name` varchar(50) NOT NULL,
|
||||
`our_price` decimal(10,2) NOT NULL,
|
||||
`competitor_price` decimal(10,2) NOT NULL,
|
||||
`price_gap_percent` decimal(5,2) NOT NULL,
|
||||
`action_taken` enum('notification_sent','price_adjusted','ignored') NOT NULL DEFAULT 'ignored',
|
||||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_country_created` (`country_code`, `created_at`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
--
|
||||
-- Table structure for table `driver_destinations`
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `driver_destinations` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`driver_id` varchar(100) NOT NULL,
|
||||
`target_latitude` decimal(10,7) NOT NULL,
|
||||
`target_longitude` decimal(10,7) NOT NULL,
|
||||
`destination_name` varchar(150) DEFAULT NULL,
|
||||
`is_active` tinyint(1) DEFAULT 1,
|
||||
`usage_date` date NOT NULL,
|
||||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_driver_date` (`driver_id`, `usage_date`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
Reference in New Issue
Block a user