Prisma

P

Prisma

The official Discord server of Prisma! Find us online at prisma.io

Join

Create prisma client with extension without circular dependency

FOUND SOLUTION: Prisma.defineExtension takes a callback which receives the client --------------- ...

Error.code not defined for Deadlock & 40P01 error

Hi there, My script sometimes breaks as I've encounter a deadlock error. The error is the following one: ...

Hi everyone. I have a question regarding NestJS and Prisma ORM.

Hi everyone. I have a question regarding NestJS and Prisma ORM. I'm working with a table that includes fields like createdAt, updatedAt, etc. When querying with Prisma, I'd like to alias these field names to created_at, updated_at, and so on. Does Prisma have any operators or functionality that support aliasing field names? Thanks in advance for your help!

Migrating a One2One field to a One2Man

Want to change my schema to make a specific field a One2Many[] now, is there a good way to roll this out without destroying all the existing ORM code

message: "invalid byte sequence for encoding \"UTF8\": 0x00

i am using prisma for my postgresql database and i get this error ```Error occurred during query execution: ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: "22021", message: "invalid byte sequence for encoding "UTF8": 0x00", severity: "ERROR", detail: None, column: None, hint: None }), transient: false }) at In.handleRequestError (/opt/render/project/src/node_modules/@prisma/client/runtime/library.js:122:7067) at In.handleAndLogRequestError (/opt/render/project/src/node_modules/@prisma/client/runtime/library.js:122:6211)...

"The preview feature "omitApi" is not known." when trying to add 'omitApi' to the preview features.

I'm getting this error when trying to enable omitApi via the Prisma Schema. But it doesn't seem to be a possible entry of the options for whatever reason. I'm using "prisma": "^5.16.2"...
No description

Cleaner Way to Write Prisma Schema for Badge System

I'm working on a badge system for my web app and would appreciate any suggestions for cleaning up this Prisma schema datasource db { provider = "mongodb" url = env("DATABASE_URL")...

prisma client error

⨯ PrismaClientKnownRequestError: Invalid prisma.user.create() invocation: Unique constraint failed on the fields: (username)...

500 Internal Server Error from Pulse console setup

I am trying to configure Pulse for my existing Prisma project, but when I put in my details and hit "Enable Pulse" from the console.prisma.io/PROJECTID/pulse/setup I get a 500 Internal Server Error every time, despite Prisma Pulse being up according to the status site here https://www.prisma-status.com/. I'm not sure what other information you'd need to diagnose this, so let me know if you need more than the following: - Request that's failing: https://console.prisma.io/PROJECTID/pulse/setup?_data=routes%2F_app.%24organizationId_.%24projectId_.%24environmentId.pulse.setup - My database is Vercel Postgres database...

Prisma Client is not configured to run in the edge runtime

I am not using the edge runtime. I am using the nodejs runtime! No Error: ```ts import { PrismaClient } from "@prisma/client";...
No description

How to use getDMMF

I use the following code to load the dmmf from a absolute path: ```ts const PYLON_ABSOLUTE_PATH = '/Users/schettn/Documents/pylon/pylon-template' ...

Get type of prisma client before it is defined

In my next.js app I have to use the following approach to prevent multiple instances of PrismaClient being created ```ts import { PrismaClient } from "@prisma/client"; ...

How to reference/store a joined primary key?

I have a program that imports data from a CSV file into the database using Prisma. In the Excel the rows have something similar to an ID, a category and other non-important stuff. Since the ID is not unique in this CSV, I created a joined primary key in my schema file (@@id([category, id])). Is there any way I can reference this joined primary key in a relation? E.g.:...

error with simple request

Hi, I am getting this error with simple query, I am using nextjs with mongodb, prisma accelerate. `` Invalid prisma.user.count()` invocation:...

create many skip existing

I want to createmany rows in a table, but if that row already exists (excluing the ID row), then skip that row. afaik, the skipDuplicates key will skip duplicates within the set of new rows you are adding, but it does not check the existing rows eg:...

why does my table with the name users show up as uSER in my prismaclient?

``` model users { id Int @id @default(autoincrement()) @unique email String @unique password String...

GET request using JSON body

context: prisma,zod,typescript I'm trying to run a GET request and passing in a json body, In order to make this work i need to convert it to using .mutation instead of .query. I was wondering if this is the standard for using prisma as I know posts will still return data. for example: in my postman json: ...

Unable to connect Prisma to RDS database

I am deploying a beta version of my webapp to prod however I am unable to connect to my RDS db. I have tried multiple different engines (Aurora Mysql, Mysql 8.0.35, MariaDB 10.11.6) I keep getting the error "PrismaClientInitializationError: Authentication failed against database server at db-host, the provided database credentials for db-user are not valid" The credentials are definitely correct and I have tested connecting to the database without Prisma and it works perfectly fine. ...

Date field default value

I have a use case for a date field that has a default value, for the sake of the question, it'll be 1970-01-01. In my prisma file it is set as follows: ```...