Compare commits

...

2 commits

Author SHA1 Message Date
f87f3a15d3 Merge pull request 'fix(sql): ALTER TABLE IF EXISTS in migration 162 (deploy red — district_economics absent)' (#1726) from fix/migration-162-table-if-exists into main
All checks were successful
Deploy / changes (push) Successful in 8s
Deploy / build-frontend (push) Has been skipped
Deploy / build-backend (push) Successful in 35s
Deploy / build-worker (push) Successful in 36s
Deploy / deploy (push) Successful in 1m41s
2026-06-17 20:02:34 +00:00
d46695ba50 fix(sql): ALTER TABLE IF EXISTS in migration 162 — district_economics absent on main DB (deploy red)
All checks were successful
CI / changes (pull_request) Successful in 6s
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Successful in 2m24s
CI / backend-tests (pull_request) Successful in 9m4s
2026-06-17 20:02:06 +00:00

View file

@ -5,8 +5,14 @@
-- The live market sub-score uses sat_score = min(100, sold_pct * 100 / 70) directly,
-- so sat_factor double-counts absorption without being applied anywhere.
-- All code references removed in the same commit as this migration.
--
-- NB: ALTER TABLE *IF EXISTS* — district_economics is created by the site-finder
-- pipeline (09_macro_and_trend.py / server.py), NOT by data/sql migrations, so it may
-- be absent on the main Postgres. Without IF EXISTS the deploy fails with
-- "relation district_economics does not exist" (DROP COLUMN IF EXISTS only guards the
-- column, not the table). Idempotent + safe when the table is absent.
BEGIN;
ALTER TABLE district_economics DROP COLUMN IF EXISTS sat_factor;
ALTER TABLE IF EXISTS district_economics DROP COLUMN IF EXISTS sat_factor;
COMMIT;