fix(tradein-sql): rename dup 030, add trade_in_estimates geom, drop dup indexes #500
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#500
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/sql-rename-030-and-schema-debt"
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
Close 3 SQL schema findings from 2026-05-24 trade-in audit:
All migrations idempotent (IF NOT EXISTS / CREATE OR REPLACE). Apply order:
030_avito_imv_cache_key_unique -> 031_houses_alter_yandex -> 032_yandex_history -> 033_listings_alter_yandex -> 034 -> 035 -> 040_...
DDL inversion (031 before 033) safe: 031 touches houses, 033 touches listings, no cross-table dep.
Test plan
Merged via deep-code-reviewer — verdict APPROVE.
Cross-checks performed:
ls -1 *.sql | sort+ON_ERROR_STOP=on || echo "skipped"per file, no tracking table — relies entirely on idempotent SQL patterns. Re-run safe for ALL migrations on each deploy.030_listings_alter_yandex.sqlalready applied → renamed033_*.sqlwill no-op viaADD COLUMN IF NOT EXISTS.listing_sources_listing_idx2(050) = exact dup oflisting_sources_listing_idx(028) — confirmedhouses_geom_idx2(050) = exact dup ofhouses_geom_idx(009) — confirmed (bothGIST(geom)no filter)DROP TRIGGER IF EXISTS ... CREATE TRIGGER— correct PG-portable idempotent patternCONCURRENTLYconflict (intentional — small tables make CONCURRENTLY unnecessary)UPDATE ... WHERE geom IS NULLsmartly preempts existing-rows edge caseNits (non-blocking, ignore):
reuse listings_set_geom(009 pattern) for DRY, but separate ownership = independent evolution; acceptable trade-offDROP INDEX(без CONCURRENTLY) — ACCESS EXCLUSIVE lock на ms-only, on small trade-in DB non-issuePost-merge verification suggested:
deploy-tradein.ymlfinish onmainpush\d trade_in_estimatesshowsgeom geometry(Point,4326)\di trade_in_estimates_geom_idxexists\di listing_sources_listing_idx2returns nothing\di houses_geom_idx2returns nothing