postgis.Geometry can't declare a subtype like geometry(Polygon, 4326)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- postgresql, typescript
Research direction
Start by tracing postgis.Geometry through contract inference, schema verification, and the DDL planner; the issue does not name implementation files or tests. Reproduce with a PostGIS column declared as geometry(Polygon, 4326) and follow the reported prisma contract infer → prisma db sign flow. Done when subtype declarations are inferred and accepted by verification and the planner renders the matching DDL.
Written by the indexing model from the issue text.
Description
Package and version
What happened?
Package and version
@prisma/[email protected], @prisma/[email protected], [email protected]
Problem
postgis.Geometry(srid?) can only describe geometry or geometry(Geometry, <srid>). There is no way to declare a geometry subtype (Polygon, Point, LineString, MultiPolygon, ...), which is the common way PostGIS columns are typed.
As a result, an existing database with a typed geometry column can't be adopted:
prisma contract inferproducespostgis.Geometry(...)for the column, losing the subtype.prisma db signthen fails schema verification on that column, so the app space can't be signed and migrations can't be chained from it:
✘ app: not signed, the schema does not satisfy its contract
└─ ✘ mismatch: database/public/table_a/column:shape
✘ [CONTRACT.SCHEMA_VERIFICATION_FAILED] Database schema does not satisfy contract (1 failure)
Live column vs. contract:
| Live database | Contract | |
|---|---|---|
table_a.shape |
geometry(Polygon) |
postgis.Geometry() → geometry |
table_b.shape |
geometry(Polygon, 4326) |
postgis.Geometry(4326) → geometry(Geometry, 4326) |
What did you expect to happen?
Accept an optional geometry subtype, mirroring PostGIS's geometry(<subtype>, <srid>) modifier:
types {
AreaPolygon = postgis.Geometry("Polygon", 4326) // geometry(Polygon, 4326)
PlainPolygon = postgis.Geometry("Polygon") // geometry(Polygon)
Position = postgis.Geometry("Point", 4326) // geometry(Point, 4326)
}
with contract infer emitting the subtype from the live column, db verify / db sign comparing it, and the planner rendering it in DDL. Ideally the TypeScript result type narrows by subtype too (e.g. a Polygon GeoJSON type rather than any Geometry), but the DDL/verification part alone would unblock adoption.
Minimal reproduction
- In a Postgres database with PostGIS:
CREATE TABLE areas (id serial PRIMARY KEY, shape geometry(Polygon, 4326)); prisma contract infer, thenprisma contract emitwithextensions: [postgis]inprisma.config.ts.prisma db sign→CONTRACT.SCHEMA_VERIFICATION_FAILEDonareas.shape.
types {
AreaPolygon = postgis.Geometry(4326)
}
model Area {
id Int @id @default(autoincrement())
shape AreaPolygon?
@@map("areas")
}
Environment
- Node: v22.23.2
- OS: Linux 6.18
- Package manager: npm 10.9.8
- Database: PostgreSQL with PostGIS
Additional context
No response
- Dominant language
- TypeScript
- Stars
- 47.8k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 227
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from prisma/orm
-
bug/1-unconfirmed kind/bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
get-platform: distros with ID_LIKE=alpine are not detected as musl, so glibc engines are used on Alpine-based imagesPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
prisma/orm#31281 · 1 comment ·
Maintainers usually reply within 1 day
-
adapter-pg: connectToShadowDb connects to the main database when built from a connection stringMay be free again @cestercian claimed this 10 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
prisma/orm#31196 · 1 comment ·
Maintainers usually reply within 1 day
-
[Prisma 8] Type-check time grows exponentially with chained .include() callsPossibly taken @SiKreuz claimed this 13 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
prisma/orm#31161 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
prisma/orm#31125 · 4 comments · 6 reactions ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
tenstorrent/ttnn-visualizer#2526 ·
Maintainers usually reply within 1 day
-
trySessionCache calls /get-session twice when minting session_data (cache miss or expired cookie)Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
neondatabase/neon-js#301 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
tashfeenahmed/freellmapi#2305 ·
Maintainers usually reply within 1 day