chore: استيراد أولي من سيرو (ecfe7568) — بلا أي تعديل
نسخة كاملة من مستودع سيرو عند ecfe7568 لتكون أساس تطبيق «انطلق». نُسخ المتعقَّب في git فقط (12,509 ملفاً / 302 م.ب) بـ git archive، لا `cp -r` — فاستُثنيت تلقائياً مخلفات البناء (build · node_modules · .dart_tool · .gradle · Pods ≈ 10.7 غ.ب) وكل ما يستثنيه .gitignore. هذا الكوميت **بلا أي تعديل عمداً** حتى يكون كل ما يليه فرقاً مقروءاً مقابل سيرو الأصلي. سيرو نفسه لم يُمسّ. ⚠️ لا يبني بعد: `.env` و`lib/env/env.g.dart` غير متعقَّبين في سيرو (وهذا صحيح — أسرار لكل مستأجر). كل تطبيق فلاتر هنا يحتاج .env خاصاً بانطلق ثم توليد env.g.dart عبر build_runner. لا تُنسخ أسرار سيرو. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
-- Migration 002: Fix surge insights unique key
|
||||
-- Problem: The old unique key included peak_start_hour and peak_end_hour,
|
||||
-- which meant a new record was inserted every time the peak window shifted,
|
||||
-- instead of updating the existing one.
|
||||
-- Fix: The unique key now only covers (competitor_name, country_code),
|
||||
-- so ON DUPLICATE KEY UPDATE always updates the existing row correctly.
|
||||
|
||||
-- Step 1: Drop the old unique key that included peak hours
|
||||
ALTER TABLE `competitor_surge_insights`
|
||||
DROP INDEX `unique_surge`;
|
||||
|
||||
-- Step 2: Add the correct unique key — one row per competitor per country
|
||||
ALTER TABLE `competitor_surge_insights`
|
||||
ADD UNIQUE KEY `unique_surge` (`competitor_name`, `country_code`);
|
||||
|
||||
-- Verify: show the new index
|
||||
-- SHOW INDEX FROM `competitor_surge_insights`;
|
||||
@@ -0,0 +1,16 @@
|
||||
-- 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;
|
||||
Reference in New Issue
Block a user