fix: keep growth analysis available per terminal
This commit is contained in:
13
migrations/000003_ai_summary_refresh.sql
Normal file
13
migrations/000003_ai_summary_refresh.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
DROP INDEX IF EXISTS growth_reports_daily_merchant_refresh_idx;
|
||||
|
||||
-- statement-break
|
||||
CREATE INDEX IF NOT EXISTS growth_reports_scope_refresh_day_idx
|
||||
ON growth_reports (merchant_id, terminal_source_key, tehran_refresh_day, created_at DESC)
|
||||
WHERE manual_refresh = true;
|
||||
|
||||
-- The application serializes scope-specific refresh decisions with a PostgreSQL
|
||||
-- advisory transaction lock. A refresh consumes the daily slot only after the
|
||||
-- requested scope has a persisted READY report with AI copy.
|
||||
|
||||
-- statement-break
|
||||
INSERT INTO schema_migrations(version) VALUES (3) ON CONFLICT DO NOTHING;
|
||||
Reference in New Issue
Block a user