نسخة كاملة من مستودع سيرو عند 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>
18 lines
782 B
SQL
18 lines
782 B
SQL
-- 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`;
|