You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[PostGIS] Using geometry type for column causes schema validation error #29566
Can't create a migration to add a (table containing a) PostGIS column like geometry - even the example from the doc is not working. Maybe I've missed something?
Set up a Prisma project to manage migrations for your DB (following the Prisma documentation for existing DBs), and be sure to add CREATE EXTENSION IF NOT EXISTS postgis; in your initial migration file
Try adding some columns/tables (using standard Postgres types) to the schema file, and generating/applying Prisma migrations, to verify that non-PostGIS migrations are working fine
In your schema.prisma file, add a table with a geometry, as explained in the docs:
model Location {
id Int @id @default(autoincrement())
name String
position Geometry(Point, 4326)? // [!code highlight]
}
Try to create the migration file: bunx --bun prisma migrate dev --create-only --name create-location
Expected vs. Actual Behavior
Expected result
The migration file should be created (and the table should be created in your DB if you omit the --create-only flag).
Actual result
The command fails with the following output:
Loaded Prisma config from prisma.config.ts.
Prisma schema loaded from prisma\schema.prisma.
Error: Prisma schema validation - (get-config wasm)
Error code: P1012
error: Error validating: This line is not a valid field or attribute definition.
--> prisma\schema.prisma:245
|
244 | name String
245 | position Geometry(Point, 4326)? // [!code highlight]
246 | }
|
Validation Error Count: 1
[Context: getConfig]
Prisma CLI Version : 7.8.0
Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
No idea
Workaround
Using Unsupported("geometry") instead of Geometry* works. But that's only a workaround, because I want to benefit from Prisma's PostGIS integration, not just create a column which is meaningless to Prisma.
Prisma Schema & Queries
modelLocation { id Int @id@default(autoincrement()) name String position Geometry(Point, 4326)? // [!code highlight]}
Prisma doesn't actually have PostGIS integration, the feature is not merged or reviewed yet. The docs are incorrect. The Prisma team have not acknowledged this even though it has been raised with them multiple times.
Ok, thanks a lot for clarifying! If the PR is still delayed, it may make more sense to open a PR to add an explanation banner on top of the Prisma+PostGIS doc page which got merged too early - hopefully this new PR would get merged faster. I'll check if I can find some time for this.
Since this PR hasn't merged, I've published the same PostGIS fork to npm as @vertexa/prisma, @vertexa/prisma-client, and @vertexa/prisma-adapter-pg (v7.8.6) — drop-in
replacements that add Geometry/Geography scalar types, near/within/intersects spatial
filters, distanceFrom ordering, and automatic GeoJSON ↔ EWKB serialization.
Activity
vitzalt commentedon May 18, 2026
Prisma doesn't actually have PostGIS integration, the feature is not merged or reviewed yet. The docs are incorrect. The Prisma team have not acknowledged this even though it has been raised with them multiple times.
#29365
prisma/prisma-engines#5797
#2789
TanguyP commentedon May 18, 2026
Ok, thanks a lot for clarifying! If the PR is still delayed, it may make more sense to open a PR to add an explanation banner on top of the Prisma+PostGIS doc page which got merged too early - hopefully this new PR would get merged faster. I'll check if I can find some time for this.
lh0x00 commentedon Aug 7, 2026
Since this PR hasn't merged, I've published the same PostGIS fork to npm as
@vertexa/prisma,@vertexa/prisma-client, and@vertexa/prisma-adapter-pg(v7.8.6) — drop-inreplacements that add Geometry/Geography scalar types, near/within/intersects spatial
filters, distanceFrom ordering, and automatic GeoJSON ↔ EWKB serialization.
npm install
@vertexa/prisma@vertexa/prisma-client@vertexa/prisma-adapter-pg{ "pnpm": { "overrides": { "@prisma/client": "npm:@vertexa/prisma-client@7.8.6", "@prisma/adapter-pg": "npm:@vertexa/prisma-adapter-pg@7.8.6" } } }