Prisma

P

Prisma

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

Join

Sort by nulls

Is there a way to sort and not show nulls or empty strings? I added last: null, but it doesn't work : ```ts this.prisma.toSource.findMany({ where,...

Prisma Enum Mapping

I have this enum in my prisma.schema is there a way for me to map it the same way as I map in my schema? ```ts enum CombatCategory { TANK_MELEE @map("M1")...
No description

Prisma schema folder

Hi. Today I upgraded Prisma to latest version i.e. from 5.8 to 5.16. But my docker setup is not able to find prisma schema file. I had to add following line to make it work COPY ./prisma ./prisma I can't understand why it is needed now and was not needed before....
No description

Prisma.io Console 500

It looks like there's issue with 500 errors when turning on prisma pulse. Once we enable it the project starts throwing 500 errors. I saw there was some issues this morning. Is this still something that is happening?
No description

Error using PrismaClient with Cloudflare Pages

I'm successfully using Prisma with a CF Workers project using the adapter like this:
const prisma = new PrismaClient({ adapter: new PrismaD1(c.env.DB) });
const prisma = new PrismaClient({ adapter: new PrismaD1(c.env.DB) });
...

How can i get the change the return type of a prisma function based on a generic type?

This code works, but if I change the include parameter it doesn't get reflected in the return type of "prisma.user.findFirst". I know this is more of a typescript question but maybe some of you guys have solved this before? ```ts export async function verifyAuth<I extends Prisma.UserInclude>(token: string, include?: I) { return prisma.user.findFirst({...

$queryRawUnsafe takes a long time to respond

Hi ! I have a problem with an SQL query. I'm on a MySQL database, and I'm doing a select with 5 joins via a $queryRawUnsafe, and the query takes 40 seconds. When I use mysql2 or MySQLWorkbench, it takes 4 seconds. I wanted to know if there was a reason, and if there is a way to correct this latency. prisma version: 5.15.0...

Include in findone return null if the join table not have its id

I have table "sometable" and "purchase_items" table. in purchase_items, i have sometable_id. im trying to include purchase_items in findOne purchase_items. it works when purchase_items have data with sometable_id, but it return null when example: sometable has id = 9, but purchase_items has no sometable_id = 9. i want to still get the data, with purchase_items: []. is it posible?...
No description

Definitive Solution for automatic migration running?

Hey there! I want to use Prisma in an open-source application others can deploy on their own servers. I want the user to not worry about having to run any migrations, especially after updates, etc. What would be the definitive solution to make my app ensure that it's always on the latest state regarding migrations on launch? I've seen quite a few solutions, such as a wrapper that runs migrate and then launches the app, but that seems kind of hacky, so I was wondering if there's something better?...

please help me to setup prisma for my ds ticket bot

i have this messeges from my ds bot:
[ERROR] Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again. In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues at new PrismaClient (C:\Users\Roma\Downloads\bot-main\node_modules.prisma\client\index.js:5:11) at Client.login (C:\Users\Roma\Downloads\bot-main\src\client.js:93:17)...

Help: squashing migrations

I'm trying to squash my migrations into one migrations and I was wondering if we are surpose to remove all contents in the .prisma/migrations folder including the migration_lock.toml?

Using upsert when `Notifications` table doesn't exist yet for user

I have a query to update a users notification preferences, but there's no data existing data yet inside the table. How can I change the query to accodomate that? ``` await prisma.notifications.upsert({ where: { id }, data: { type,...

Initial find query giving weird error

Hey guys, for some reason every time I try to register, I get this error: `` Invalid db.user.findUnique()` invocation 1 const db = require('./prisma'); 2...

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)...