gendesign/tradein-mvp/backend/data/sql
lekss361 94cf199276
Some checks failed
Deploy Trade-In / changes (push) Successful in 5s
Deploy / changes (push) Successful in 5s
Deploy Trade-In / build-frontend (push) Successful in 26s
Deploy Trade-In / build-backend (push) Successful in 47s
Deploy / build-frontend (push) Successful in 29s
Deploy / build-backend (push) Successful in 1m24s
Deploy Trade-In / deploy (push) Successful in 40s
Deploy / build-worker (push) Successful in 2m57s
Deploy / deploy (push) Failing after 37s
feat(tradein): postgres_fdw live read of gendesign.cad_buildings (replaces snapshot) (#493)
Replaces tradein.cad_buildings snapshot with live postgres_fdw foreign table reading gendesign.v_tradein_cad_buildings. Fixes /trade-in/api/v1/geocode/reverse 500 (Nominatim ban) and address_not_geocoded for cadastre addresses (e.g. Хохрякова 81).

Security (deep-review fixes):
- 100_tradein_fdw_role.sql: passwordless CREATE ROLE; password set by deploy.yml ALTER ROLE bootstrap reading GENDESIGN_FDW_PASSWORD from backend/.env.runtime (via psql :'pw' var → format %L — injection-safe).
- core/fdw.py: regex whitelist [A-Za-z0-9_-]{32,256} on password, ValueError without echoing value, try/rollback on commit.
- 060_postgres_fdw_extension.sql: connect_timeout='3' on FOREIGN SERVER + ALTER ADD/SET fallback.
- geocoder.py: _cadastral_forward_sync / _cadastral_reverse_sync wrapped in asyncio.to_thread.
- 100_*.sql: REVOKE ALL ON ALL TABLES/SEQUENCES/FUNCTIONS IN SCHEMA public; only GRANT SELECT on v_tradein_cad_buildings.
- pg_user_mappings query handles PUBLIC mapping (usename IS NULL).

Tests: 3 SQL-injection guards on ensure_fdw_user_mapping + rewritten cadastral suite.
2026-05-24 08:57:30 +00:00
..
001_trade_in_estimates.sql feat: add tradein-mvp subproject (Trade-In Estimator под /trade-in) 2026-05-21 00:25:39 +03:00
002_core_tables.sql feat: add tradein-mvp subproject (Trade-In Estimator под /trade-in) 2026-05-21 00:25:39 +03:00
003_seed_deals.sql fix(tradein): убрать TRUNCATE из seed — деплой больше не wipe-ит данные 2026-05-21 13:19:24 +03:00
004_extend_trade_in_estimates.sql feat: add tradein-mvp subproject (Trade-In Estimator под /trade-in) 2026-05-21 00:25:39 +03:00
005_geocode_tracking.sql feat(tradein): geocode-missing для deals (#4 завершение) 2026-05-21 20:04:19 +03:00
007_estimate_photos.sql feat(tradein): backend загрузки фото квартиры (#394) 2026-05-22 11:05:35 +05:00
008_crm_fields.sql feat(tradein): CRM-поля в форме оценки (#395) 2026-05-22 11:15:15 +05:00
009_houses.sql feat(tradein): SQL migrations 009-018 — houses + listings extension + IMV cache (#440) 2026-05-23 11:41:44 +00:00
010_houses_alter.sql feat(tradein): SQL migrations 009-018 — houses + listings extension + IMV cache (#440) 2026-05-23 11:41:44 +00:00
011_listings_alter.sql feat(tradein): SQL migrations 009-018 — houses + listings extension + IMV cache (#440) 2026-05-23 11:41:44 +00:00
012_sellers.sql feat(tradein): SQL migrations 009-018 — houses + listings extension + IMV cache (#440) 2026-05-23 11:41:44 +00:00
013_listings_alter_seller.sql feat(tradein): SQL migrations 009-018 — houses + listings extension + IMV cache (#440) 2026-05-23 11:41:44 +00:00
014_house_reviews.sql feat(tradein): SQL migrations 009-018 — houses + listings extension + IMV cache (#440) 2026-05-23 11:41:44 +00:00
015_scrape_runs.sql feat(tradein): SQL migrations 009-018 — houses + listings extension + IMV cache (#440) 2026-05-23 11:41:44 +00:00
016_listings_snapshots.sql feat(tradein): SQL migrations 009-018 — houses + listings extension + IMV cache (#440) 2026-05-23 11:41:44 +00:00
017_house_placement_history.sql feat(tradein): SQL migrations 009-018 — houses + listings extension + IMV cache (#440) 2026-05-23 11:41:44 +00:00
018_avito_imv_evaluations.sql feat(tradein): SQL migrations 009-018 — houses + listings extension + IMV cache (#440) 2026-05-23 11:41:44 +00:00
019_listings_alter_cian.sql feat(tradein): SQL migrations 019-028 — Cian schema + matching + cookies 2026-05-23 15:14:49 +03:00
020_houses_alter_cian.sql feat(tradein): SQL migrations 019-028 — Cian schema + matching + cookies 2026-05-23 15:14:49 +03:00
021_management_companies.sql feat(tradein): SQL migrations 019-028 — Cian schema + matching + cookies 2026-05-23 15:14:49 +03:00
022_agents_table.sql feat(tradein): SQL migrations 019-028 — Cian schema + matching + cookies 2026-05-23 15:14:49 +03:00
023_offer_price_history.sql feat(tradein): SQL migrations 019-028 — Cian schema + matching + cookies 2026-05-23 15:14:49 +03:00
024_houses_price_dynamics.sql feat(tradein): SQL migrations 019-028 — Cian schema + matching + cookies 2026-05-23 15:14:49 +03:00
025_house_reliability_checks.sql feat(tradein): SQL migrations 019-028 — Cian schema + matching + cookies 2026-05-23 15:14:49 +03:00
026_external_valuations.sql feat(tradein): SQL migrations 019-028 — Cian schema + matching + cookies 2026-05-23 15:14:49 +03:00
027_cian_session_cookies.sql feat(tradein): SQL migrations 019-028 — Cian schema + matching + cookies 2026-05-23 15:14:49 +03:00
028_matching_tables.sql feat(tradein): SQL migrations 019-028 — Cian schema + matching + cookies 2026-05-23 15:14:49 +03:00
029_extend_matching_valuation_dynamics.sql feat(tradein): SQL migration 029 — extend matching/valuation/dynamics tables (PR #445 follow-up) (#448) 2026-05-23 12:35:03 +00:00
030_avito_imv_cache_key_unique.sql fix(tradein): 030 — UNIQUE constraint on avito_imv_evaluations.cache_key (unblocks PR #452) (#454) 2026-05-23 13:04:21 +00:00
030_listings_alter_yandex.sql feat(tradein): SQL migrations 030-032 — Yandex schema (listings/houses/history) (#453) 2026-05-23 13:00:54 +00:00
031_houses_alter_yandex.sql feat(tradein): SQL migrations 030-032 — Yandex schema (listings/houses/history) (#453) 2026-05-23 13:00:54 +00:00
032_yandex_history.sql feat(tradein): SQL migrations 030-032 — Yandex schema (listings/houses/history) (#453) 2026-05-23 13:00:54 +00:00
040_houses_extend.sql feat(tradein): SQL 040-046 — matching schema delta (Phase 1.1) (#464) 2026-05-23 13:30:22 +00:00
041_house_sources_noop.sql feat(tradein): SQL 040-046 — matching schema delta (Phase 1.1) (#464) 2026-05-23 13:30:22 +00:00
042_listing_sources_price_divergence_idx.sql feat(tradein): SQL 040-046 — matching schema delta (Phase 1.1) (#464) 2026-05-23 13:30:22 +00:00
043_house_reviews_extend.sql feat(tradein): SQL 040-046 — matching schema delta (Phase 1.1) (#464) 2026-05-23 13:30:22 +00:00
044_external_valuations_link.sql feat(tradein): SQL 040-046 — matching schema delta (Phase 1.1) (#464) 2026-05-23 13:30:22 +00:00
045_house_placement_history_extend.sql feat(tradein): SQL 040-046 — matching schema delta (Phase 1.1) (#464) 2026-05-23 13:30:22 +00:00
046_views.sql feat(tradein): SQL 040-046 — matching schema delta (Phase 1.1) (#464) 2026-05-23 13:30:22 +00:00
050_search_optimization.sql feat(tradein): search matview + indexes (Phase 3.1) (#469) 2026-05-23 14:01:18 +00:00
051_scrape_runs_extend.sql feat(tradein): city sweep — auto ЕКБ pipeline (#477) 2026-05-23 14:38:07 +00:00
052_scrape_schedules.sql feat(tradein): in-app scheduler — UI-managed schedule (replaces SSH crontab) (#482) 2026-05-23 14:54:25 +00:00
053_scraper_settings.sql feat(tradein): scraper_settings live-config + Yandex admin trigger endpoints (#484) 2026-05-23 15:28:34 +00:00
054_scraper_settings_global.sql feat(tradein): global scraper delay setting (applies across all scrapers) (#485) 2026-05-23 15:43:28 +00:00
060_postgres_fdw_extension.sql feat(tradein): postgres_fdw live read of gendesign.cad_buildings (replaces snapshot) (#493) 2026-05-24 08:57:30 +00:00
061_drop_legacy_cad_buildings.sql feat(tradein): postgres_fdw live read of gendesign.cad_buildings (replaces snapshot) (#493) 2026-05-24 08:57:30 +00:00