From 4b2e7d9af856402b21040ce3d44254320e807991 Mon Sep 17 00:00:00 2001 From: Light1YT Date: Mon, 8 Jun 2026 14:04:51 +0500 Subject: [PATCH] fix(db): sync location.demand_index comment to city-relative (#948) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The demand_index DB column comment still said "насыщающее преобразование" (saturating) after #1167 switched it to city-relative normalization — exactly the misleading-comment class that hid the original bug. Migration 147 updates COMMENT ON COLUMN (idempotent, comment-only, no data DDL). Refs #948 --- data/sql/147_location_demand_comment.sql | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 data/sql/147_location_demand_comment.sql diff --git a/data/sql/147_location_demand_comment.sql b/data/sql/147_location_demand_comment.sql new file mode 100644 index 00000000..ed94cb46 --- /dev/null +++ b/data/sql/147_location_demand_comment.sql @@ -0,0 +1,20 @@ +-- 147_location_demand_comment.sql +-- #948 / #1167: demand_index перешёл с saturating-АБСОЛЮТНОЙ нормировки +-- (clamp01(unit_velocity / 50), фикс. константа) на CITY-RELATIVE: район / +-- max-скорость по городу за прогон refresh_locations (зеркало infra_index). +-- +-- Причина: на live-прогоне ВСЕ 8 районов ЕКБ давали demand=1.0 (каждый продаёт +-- ≥50 кв/мес → индекс насыщался в 1.0 везде → ноль дискриминации). См. PR #1167. +-- +-- Эта миграция ТОЛЬКО синхронизирует DB-комментарий столбца с новым кодом — старый +-- текст «насыщающее преобразование» теперь врёт (ровно класс «вводящего в +-- заблуждение комментария», который и спрятал баг). Idempotent: COMMENT ON +-- безопасен к повторному применению; никакого DDL над данными. +-- +-- Deploy: auto-applied deploy.yml через _schema_migrations (ровно один раз по NN). +-- Требует таблицу `location` из 146 (147 > 146 лексикографически → применяется после). + +COMMENT ON COLUMN location.demand_index IS + 'Индекс спроса 0..1: city-relative нормировка market_metrics.unit_velocity ' + '(скорость продаж района / max-скорость по городу за прогон refresh_locations). ' + 'NULL при недостатке данных (никогда не фабрикуем 0).';