Some checks failed
Deploy Trade-In / build-frontend (push) Has been skipped
Deploy Trade-In / build-browser (push) Has been skipped
Deploy Trade-In / test (push) Successful in 33s
Deploy Trade-In / deploy (push) Blocked by required conditions
Deploy Trade-In / changes (push) Successful in 6s
Deploy Trade-In / build-backend (push) Has been cancelled
Миграция 100_enable_deactivate_stale_avito.sql — идемпотентный UPDATE scrape_schedules SET enabled=true, next_run_at=NOW() WHERE source='deactivate_stale_avito' AND enabled=false. Чинит QA-находку #759: 090 ON CONFLICT DO NOTHING оставил pre-seed disabled-строку → task ни разу не отработала. Non-destructive, guard на повторный прогон. +7 тестов. Closes #759. Co-authored-by: lekss361 <lekss361@gendsgn.local> Co-committed-by: lekss361 <lekss361@gendsgn.local>
19 lines
913 B
PL/PgSQL
19 lines
913 B
PL/PgSQL
-- #759: deactivate_stale_avito schedule seeded enabled=false → task never ran on prod.
|
|
--
|
|
-- Root cause: migration 090 (ON CONFLICT (source) DO NOTHING) was a no-op because
|
|
-- the row 'deactivate_stale_avito' already existed in scrape_schedules with
|
|
-- enabled=false when 090 ran on prod (inserted by a pre-release iteration or manual
|
|
-- seed). The scheduler's WHERE enabled=true filter excluded it on every tick, so
|
|
-- last_run_id stayed NULL and next_run_at=2026-06-01 expired without any runs.
|
|
--
|
|
-- Fix: idempotent UPDATE that only fires when the row is still disabled.
|
|
-- Re-running this migration after the row is already enabled → 0 rows matched, safe.
|
|
--
|
|
-- No bind params → no CAST(:x AS type) needed; BEGIN/COMMIT per sql.md conventions.
|
|
BEGIN;
|
|
UPDATE scrape_schedules
|
|
SET enabled = true,
|
|
next_run_at = NOW()
|
|
WHERE source = 'deactivate_stale_avito'
|
|
AND enabled = false;
|
|
COMMIT;
|