gendesign/tradein-mvp/backend/data/sql/041_house_sources_noop.sql
lekss361 d019b5327e feat(tradein): SQL 040-046 — matching schema delta (Phase 1.1)
Multi-Source Integration Phase 1.1 thin-delta migrations. Gap audit showed
80%+ of planned schema already in 014/017/020/026/028/029/030/031 —
this PR adds only the missing pieces:

- 040 houses_extend: complex_id + avito_validated_at + cian_validated_at
- 041 house_sources_noop: COMMENT aliases for ext_source/ext_id/matched_method
- 042 listing_sources_price_divergence_idx: partial index for /search
- 043 house_reviews_extend: likes column
- 044 external_valuations_link: house_id/listing_id FKs + low/high price band
- 045 house_placement_history_extend: source_confidence + notes + 3-col UNIQUE
- 046 views: v_price_divergence + v_cross_source_health + v_data_quality

All BEGIN/COMMIT, IF NOT EXISTS, FK ON DELETE CASCADE.
Idempotent — safe re-apply on prod.

Refs Master Plan sec 1, 4-8 + Cross_Source_Matching sec 2-4.
2026-05-23 16:22:58 +03:00

16 lines
789 B
PL/PgSQL

-- 041_house_sources_noop.sql
-- Purpose: Document that house_sources already exists (028 + 029) and satisfies
-- Cross_Source_Matching_Strategy sec 2.1. Column-name aliases noted in COMMENTs.
-- Dependencies: 028_matching_tables.sql, 029_extend_matching_valuation_dynamics.sql
-- No DDL changes — idempotent COMMENT-only file.
BEGIN;
COMMENT ON COLUMN house_sources.ext_source IS
'Source identifier (alias of "source" in Master Plan sec 2.1). Values: avito/cian/yandex/n1.';
COMMENT ON COLUMN house_sources.ext_id IS
'External house id from source (alias of "ext_house_id" in Master Plan).';
COMMENT ON COLUMN house_sources.matched_method IS
'Match method (alias of "match_method" in Master Plan). Values: cadastr_exact/address_geo_year/geo_only/new/manual.';
COMMIT;