fix(tradein): renumber migration 120 + numeric cast for PERCENTILE_CONT (#573)
Rename 100_backfill_kn_price_per_m2.sql → 120_backfill_kn_price_per_m2.sql to avoid collision with three existing 100_* files on main (max was 119). Cast median_ppm2 to ::numeric in Pass 3 so ROUND(double precision, int) resolves to ROUND(numeric, int) — the double precision overload does not exist in PostgreSQL.
This commit is contained in:
parent
57214f7c49
commit
36bdda9290
1 changed files with 2 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
-- 100_backfill_kn_price_per_m2.sql
|
-- 120_backfill_kn_price_per_m2.sql
|
||||||
-- Context: Issue #573 — domrf_kn_flats.price_per_m2 is populated in only ~3.7%
|
-- Context: Issue #573 — domrf_kn_flats.price_per_m2 is populated in only ~3.7%
|
||||||
-- of rows (status='free'/'sold'/'booked'). The 756 977 NULL-status rows imported
|
-- of rows (status='free'/'sold'/'booked'). The 756 977 NULL-status rows imported
|
||||||
-- from historical DOM.RF snapshots carry total_area but no price_rub, so the
|
-- from historical DOM.RF snapshots carry total_area but no price_rub, so the
|
||||||
|
|
@ -68,7 +68,7 @@ WITH peer AS (
|
||||||
GROUP BY obj_id
|
GROUP BY obj_id
|
||||||
)
|
)
|
||||||
UPDATE public.domrf_kn_flats f
|
UPDATE public.domrf_kn_flats f
|
||||||
SET price_per_m2 = ROUND(p.median_ppm2, 2)
|
SET price_per_m2 = ROUND(p.median_ppm2::numeric, 2)
|
||||||
FROM peer p
|
FROM peer p
|
||||||
WHERE f.obj_id = p.obj_id
|
WHERE f.obj_id = p.obj_id
|
||||||
AND f.price_per_m2 IS NULL;
|
AND f.price_per_m2 IS NULL;
|
||||||
Loading…
Add table
Reference in a new issue