fix(tradein): enable deactivate_stale_avito schedule on prod (#759) #1096

Merged
bot-reviewer merged 1 commit from feat/759-enable-deactivate-schedule into main 2026-06-06 19:08:23 +00:00

1 commit

Author SHA1 Message Date
af2b540ac2 fix(tradein): migration 100 — enable deactivate_stale_avito schedule on prod (#759)
All checks were successful
CI / changes (push) Successful in 7s
CI / backend-tests (push) Has been skipped
CI / changes (pull_request) Successful in 7s
CI / backend-tests (pull_request) Has been skipped
Root cause: migration 090 used ON CONFLICT (source) DO NOTHING; prod already had
a row source='deactivate_stale_avito' with enabled=false (inserted before 090 ran),
so the INSERT was silently skipped. The scheduler's WHERE enabled=true filter meant
the task never fired (last_run_id=NULL, next_run_at=2026-06-01 expired).

Fix: add migration 100 — idempotent UPDATE SET enabled=true, next_run_at=NOW()
WHERE source='deactivate_stale_avito' AND enabled=false. Safe to re-run: 0 rows
matched once the row is already enabled. Auto-applied on next deploy via
_schema_migrations tracking in deploy-tradein.yml.

Migration 090 seed (enabled=true + ON CONFLICT DO NOTHING) is already correct for
fresh installs — no change needed there.

Tests: 7 new assertions in test_deactivate_stale_avito.py for migration 100
(exists, UPDATE source, SET enabled=true, idempotent guard, BEGIN/COMMIT, no
psycopg trap, next_run_at reset). 39 tests pass total.

Refs #759
2026-06-06 22:00:42 +03:00