feat(tradein): SQL migrations 009-018 — houses + listings extension + IMV cache #440
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#440
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/tradein-scraper-v2-migrations"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Stage 1 of Avito Scraper v2 — foundation для 4-source pipeline (search / detail / Houses Catalog / IMV API). Закрывает C-5 silent corruption (anchor+jitter → точные lat/lon после Stage 2) и подготавливает schema для 60+ новых полей.
Refs:
decisions/AvitoScraper_v2_Implementation_Plan.md— Stage 1decisions/Schema_Avito_Houses_Listings_History.md— DDL specs (sec 4.2/4.3/4.4/6/7/13/25/29-31)Files (10 миграций)
009_houses.sqlhouses(multi-source: avito/cian, geom + GIST)010_houses_alter.sql011_listings_alter.sqlhouse_ext_id,kitchen_area_m2,owners_count+owners_at_least,metro_stations,detail_enriched_at,description,views_total,house_id_fk,listing_segment)012_sellers.sqlsellers013_listings_alter_seller.sqlseller_id_fk014_house_reviews.sqlhouse_reviews015_scrape_runs.sqlscrape_runs(enum running/done/failed/zombie/skipped/banned)016_listings_snapshots.sqlobjective_lots_history)017_house_placement_history.sqlremoved_date(заполняется только из IMV API)018_avito_imv_evaluations.sqlcache_keyindex (для on-demand 24h TTL в Stage 3)Smoke test (local docker)
imv_cache_key_idx, GIST наhouses.geom, partial indexes)listingsNotes
owners_2plus booleanиз sec 13 заменён наowners_count + owners_at_least(per sec 29 update — domoteka exact fields)map_pins jsonbобъявлен в CREATE TABLE (sec 4.2); 010 ALTER оставлен сIF NOT EXISTS— идемпотентноIF NOT EXISTS→ rollback тривиален (DROP COLUMN)Test plan
Next
После merge → spawn backend-engineer для Stage 2a (avito.py refactor).
Merged via deep-code-reviewer — verdict APPROVE.
Deep review summary (10 SQL migrations, +615/-0, all P0):
CREATE TABLE/INDEX IF NOT EXISTS+ADD COLUMN IF NOT EXISTSeverywheretext + CHECK(правильный выбор vsCREATE TYPE— нет duplicate_object risk)tradein-mvp/**в deploy-tradein.yml — корректно ловитtradein-mvp/backend/data/sql/**ls -1 ... | sort(lexicographic 001..018)psql -d tradein(отдельная DB, не main gendesign — zero conflict)Post-merge verify steps:
→ Migration: 009_houses.sql... 018 sequential.NOTICE: relation already exists, skippingесли re-apply, илиCREATE TABLEдля fresh.\dt→ 7 новых tables (houses, sellers, house_reviews, scrape_runs, listings_snapshots, house_placement_history, avito_imv_evaluations) + 14 новых колонок в listings (\d listings).Minor nits (можно отдельным PR, не блокирующее):
avito_imv_evaluations.cache_keyне UNIQUE — append-only история acceptable (audit drift Avito IMV),imv_cache_key_idx (cache_key, fetched_at DESC)поддерживает latest-by-fetched_at lookuphouses.rating numeric(2,1)(009) дублируетrating_score numeric(4,2)(010) — post-Stage 2 consider DROPratingили generated columnlistings_snapshotsне partitioned — acceptable для pilot (~365k rows/year), revisit при > 10MStage 2a unblocked: spawn backend-engineer для avito.py refactor — separate session.