Prisma

P

Prisma

Join the community to ask questions about Prisma and get answers from other members.

Join

Redwood-Tutorial/Prisma Help

Hello all, It was recommended by someone in the Redwood community that I seek help here. I'm hoping we have someone familiar with the Redwood tutorial that can assist me with the tutorial. I completed it and it had all the functionality suggested at the end of the tutorial but I had several test failures. I reset by repo back to end of chapter 6 and until I could identify when the errors start happening. Once I introduce this resolver in chapter 7, section: Accessing currentUser in the API side, Add Fields to the SDL and service, This is the file posts.js. Resolver: " export const Post = { user: (_obj, { root }) => db.post.findFirst({ where: { id: root.id } }).user(),"...
No description

Why is this error hapenning on seeding?

``` $ yarn db:seed yarn run v1.22.22 warning package.json: No license field $ tsx src/seed.ts...
No description

Prisma deployment in API with TypedSql

I added a TypedSQL query to my API but it breaks my deployment CI because where "RUN npx prisma generate" does not require access to the database, "RUN npx prisma generate --sql" wants access to the database to do that. Is there any good way to build the client without access to the database, if using the --sql flag?
Solution:
No, this is a strict requirement of the --sql flag. You need to have access to a database in order to generate the correct types.

prisma neon adapter

hey, is that the right way to implement the prisma neon adapter? ```import { PrismaClient } from "@prisma/client"; import { PrismaNeon } from "@prisma/adapter-neon"; import { Pool } from "@neondatabase/serverless"; ...

Error: P1001: Can't reach database server at localhost:5432

i made my friend clone my project on his pc fresh install of pgsql but idk why he cant connect to it same password same everything but it says it cant reach (pgadmin work) using bun 1.1.26 prisma 5.20.0...
No description

Prisma Optimize 1.0.1 errors

Hi all, I am having some trouble setting up prisma optimize. I've tried solutions presented in this thread https://discord.com/channels/937751382725886062/1270167207204356178/1270167207204356178 but I have yet to get it up and running. I am repeatedly getting this error...

Prisma Studio not respecting 'not null' fields?

I'm creating a model like this: ``` model Enquirer { fName String...

dependencies

Why does npm i --omit=dev still put prisma/typescript/etc. in node_modules? Is there a way to exclude these? They are taking up 50Mb+ of space in my deploy. I though only @prisma and .prisma were needed. I have

"devDependencies": {... "prisma": "^5.20.0",...

"devDependencies": {... "prisma": "^5.20.0",...
and ...

Typed SQL Queries for nested prisma/sql directories

Hello I am considering the new Typed SQL feature and building some modular, scalable file structure for my queries. Something like: ``` prisma/sql/ ├── admin/...

I’m trying to fix an error I’m encountering in my Prisma code: This expression is not callable.

What im trying to accomplish is that when user creates an new record, we give it highest sortOrder. The error occurs in the findFirst function, and here's the message I’m seeing: ```Find the first WorkExperience that matches the filter. Note, that providing undefined is treated as the value not being there. Read more here: https://pris.ly/d/null-undefined...

prisma/client 5.20

after i upgrade to prisma/client from 5.11 to 5.20, i have below error prisma queryRawUnsafe error TypeError: Cannot read properties of undefined (reading 'length') {...

Extending client not typesafe

I'm working in a NestJS project and need to extend the prisma client to replace all Date with string. I have this code: ```ts import { Injectable, OnModuleInit } from '@nestjs/common';...

Invariant violation: migration persistence is not initialized

I have a local environment where I have created prisma migrations and such, however, when I push those migrations that have run successfully on a local db, to my staging environment and have my build pipeline attempt to deploy those new migrations. I get this error. Why is that? How can I resolve this?

FindMany Where Confusion

I'm trying to do a simple "find many where" query on the following schema: TLDR: a course has a 1 to many relationship with a scheduled event. ```...

TypeError: Cannot read properties of undefined (reading 'exec')

"Hi, does anyone know why I'm getting a TypeError: Cannot read properties of undefined (reading 'exec') when using Prisma with @prisma/adapter-neon and Next.js? The error seems to originate in library.js and could be related to the environment or connection configuration. I'm attaching a screenshot with the stack trace and debug info. Thanks in advance!"
No description

Compilation error using prisma engines

I use Prisma for interacting with the database for my code and it worked fine. Coming back to my code I get these errors which is a bit confusing. It seems some of the error is coming from Quaint. I need help and an explanation, please ``` Value::Integer(i) => i.map(PrismaValue::Int).unwrap_or(PrismaValue::Null),...

Can I use Prisma ORM in a JavaScript project?

Is it recommended to use Prisma ORM with a TypeScript project only? I'm using JavaScript and Postgres in a NodeJS project so I think I won't need a tsconfig.json file. Is it considered best practice to only use Prisma ORM with a Typescript poject?

How can I fix the migration order (already applied in production)

While working in feature branches, it is difficult to maintain the order in which the migrations are applied. Let's say we delete a table in the migration and there's another migration that modifies the column of this table. The migration that deletes the table occurs first(created) but gets applied after the modification of the column takes places. While this works in production database, because edit column migration has already been applied at the time of applying deletio migration....

Prisma.DbNull doesn't work with Prisma Accelerate

Prisma Accelerate doesn't seem to support Prisma.DbNull. This is unexpected and production-breaking for us since we enabled Accelerate. For example, if you use Accelerate: ``` import { PrismaClient } from "@prisma/client/edge"; import { withAccelerate } from "@prisma/extension-accelerate";...

Are Prisma queries parameterized to prevent SQL injections?

I was just reading about parameterized queries today and I was wondering does Prisma use parameterized queries under the hood to prevent SQL injections? I tried searching the docs for info about this, but could only find info about writing raw queries that are parameterized (which is not what I am trying to do)...
Solution:
Yes, if you turn logging on you can see the queries, it takes a touch more effort to see the parameter values, but it's doable.