Bug description
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?
Severity
⚠️ Major: Breaks core functionality (e.g., migrations fail)
Reproduction
- Set up a PostgreSQL (18.) / PostGIS (3.6.) DB
- Create a few tables in it (manually)
- 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
model Location {
id Int @id @default(autoincrement())
name String
position Geometry(Point, 4326)? // [!code highlight]
}
Prisma Config
// Standard file, didn't change anything
Logs & Debug Info
Environment & Setup
- OS: Windows 11
- Database: PostgreSQL 18, PostGIS 3.6
- Node.js version: Bun 1.3.13
Prisma Version
Bug description
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?Severity
Reproduction
CREATE EXTENSION IF NOT EXISTS postgis;in your initial migration fileschema.prismafile, add a table with a geometry, as explained in the docs:bunx --bun prisma migrate dev --create-only --name create-locationExpected 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-onlyflag).Actual result
The command fails with the following output:
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 ofGeometry*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
// N/APrisma Config
// Standard file, didn't change anythingLogs & Debug Info
Environment & Setup
Prisma Version