Repository navigation
fix: skip precision/scale comparison for spatial columns in postgres schema sync - #12801
mkovac-conductive wants to merge 1 commit into
Conversation
Code Review by Qodo
1. Aliases skip precision changes
|
0468025 to
7bdaa00
Compare
7bdaa00 to
5a8c652
Compare
|
FYI, related PR: #12742 handles something similar but for length and more generically (for all drivers and based on the data types that the driver supports). I was taking a quick look over that one some time ago and was thinking if we should do the same for precision/scale, then this PR pops up 🙃 We have |
…ort it in postgres
Geometry/geography (and other) column types have no precision or scale in
the Postgres catalog, so the value from entity metadata (for geometry, used
only to control ST_AsGeoJSON precision on read) never matches what is
introspected back. findChangedColumns therefore always reported such columns
as changed, causing the schema builder to drop and recreate related foreign
keys, composite indices, and composite unique constraints, and emit a no-op
ALTER TABLE ... ALTER COLUMN ... TYPE ...
on every synchronize/migration:generate.
Only compare precision when the column type is in withPrecisionColumnTypes,
and scale when it is in withScaleColumnTypes, mirroring how length is handled
generically in typeorm#12742. The same guard is applied to the precision/scale
branch of PostgresQueryRunner.changeColumn.
Closes typeorm#12800
Co-Authored-By: Claude Opus 4.8 <[email protected]>
5a8c652 to
673232c
Compare
commit: |
|
This repository was recently restructured into a pnpm workspace, and the If your branch has diverged enough that a full rebase isn't worth it, Sorry for the disruption, and thanks for your patience. |
Geometry/geography columns have no precision or scale in the Postgres catalog, so the value set in entity metadata (used only to control the ST_AsGeoJSON precision on read) never matches what is introspected back. This caused migration:generate to emit a no-op
on every run, an endless phantom diff that could never be resolved.
Skip the precision/scale comparison for spatial column types so it only runs where precision/scale actually round-trip through the database.
Closes #12800
Description of change
Pull-Request Checklist
masterbranchFixes #NNNN,Closes #NNNN, orResolves #NNNNtests/**.test.ts)docs/docs/**.md)