Repository navigation
fix(postgres,cockroachdb): compare spatial columns against their default feature type and SRID - #12812
Conversation
commit: |
Code Review by Qodo
1. Postgres ignores default spatial edits
|
|
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. |
…ult feature type and SRID A geometry or geography column declared without spatialFeatureType or srid is created as plain geometry, which the database reports back as Geometry with SRID 0. The change detection compared those values with the undefined metadata, so every such column produced the same no-op ALTER COLUMN TYPE on each migration:generate.
964ad8c to
34bc31f
Compare
|
Rebased onto the packages/ layout as described, with a single commit. The diff is unchanged apart from the paths, and the spatial and schema-builder suites pass on PostgreSQL and CockroachDB locally. |
Description of change
Fixes #12811
A geometry or geography column declared without
spatialFeatureTypeorsridis created as plaingeometry, which PostGIS and CockroachDB report back as feature typeGeometrywith SRID0.findChangedColumnscompared those values with the undefined metadata, so every such column produced the same no-opALTER COLUMN ... TYPEon eachmigration:generate. The repository's own spatialPosttest entity showed this drift: three phantom queries on both databases.The comparison now applies the defaults the decorator reference already documents (feature type
Geometry, SRID0) on both sides, in the Postgres and CockroachDB drivers alike. Removing a feature type or SRID from an entity still converges: the stored value then differs from the default, oneALTER COLUMN ... TYPE geometryis generated, and the next run reports no changes.Tests: a new
schema-builder/idempotency/spatial-defaultscase (postgres and cockroachdb) asserts no pending queries for such columns, and the idempotency assertions of the spatial suites, previously scoped to the dimensional table because of this drift, now cover the whole schema. Reverting the driver change makes exactly those three assertions fail with the three phantom queries. The idempotency and schema builder suites pass (155 tests), as do the spatial suites (27).Pull-Request Checklist
masterbranchFixes #NNNN,Closes #NNNN, orResolves #NNNNtests/**.test.ts)docs/docs/**.md): no documentation change, the documented defaults are now honoured