17 lines
746 B
SQL
17 lines
746 B
SQL
-- Migration: Create competitor_surge_zones table for heatmap integration
|
|
-- Purpose: Bridge the geographic surge anomalies from Node.js pricing engine to PHP heatmap
|
|
|
|
CREATE TABLE IF NOT EXISTS `competitor_surge_zones` (
|
|
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
|
`competitor_name` VARCHAR(100) NOT NULL,
|
|
`country_code` VARCHAR(5) NOT NULL,
|
|
`zone_key` VARCHAR(50) NOT NULL,
|
|
`latitude` DECIMAL(10,6) NOT NULL,
|
|
`longitude` DECIMAL(10,6) NOT NULL,
|
|
`avg_ppk` DECIMAL(10,3) NOT NULL,
|
|
`sample_count` INT NOT NULL,
|
|
`surge_multiplier` DECIMAL(5,3) NOT NULL DEFAULT 1.000,
|
|
`detected_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
UNIQUE KEY `unique_zone` (`competitor_name`, `country_code`, `zone_key`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|