prisma / prisma/orm

Support for native database composite types (`CREATE TYPE`)

Open
#4,263 37 comments 71 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature topic: database-functionality topic: postgresql
Dominant language
TypeScript
Stars
47.6k
Forks
2.5k
Avg merge
21h 59m
Merged PRs (30d)
95

Description

Problem

I found out I needed to implement a composite type (an integer type and a text type all as a single type called block) in my postgresql database for a project I am working on. I had implemented Prisma throughout most of my backend only to add this type in the db, introspect, and then see that field commented our in my schema.prisma file saying that the type is not currently supported. I looked through the docs and sure enough, no support for composite types. Now it looks I have to completely rip Prisma out of my project and find something else(although not sure what, cuz there isn't jack s*%$ for decent ORM's with node, if anyone knows something else good feel free to let me know).

There have have been other issues that I have dealt with (like not being able to delete entities with relations using the .delete() function, which I mean come on, how is that still an issue... that should be a basic feature) but at least they had work arounds, like just using executeRaw with some raw SQL to perform the delete. But this issue with no support for composite types does not seem to have any work around (outside of changing my db structure).

Suggested solution

Add support for composite types. (And fix the delete issue.)

Alternatives

Some sort of work around for those who already have composite types in use in their db and need to be able to use them with Prisma.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue identifies schema.prisma as the place where unsupported PostgreSQL composite-type fields are commented out after introspection. Start there, then determine the required behavior for CREATE TYPE support; done means composite types can be introspected and used without the schema field being commented out, while the separate delete concern is excluded.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, postgresql, typescript
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.