Questions tagged [prisma]

Prisma is a next-generation Node.js and TypeScript ORM for PostgreSQL, MySQL, SQLite, CockroachDB, MongoDB and SQL Server.

Prisma is a next-generation ORM and can be used in any Node.js or TypeScript backend application (including serverless applications and microservices). This can be a REST API, a GraphQL API a gRPC API, or anything else that needs a database. Use the Prisma client to access your database with Node.js, TypeScript or Go.

Prisma features:

  • An auto-generated and type-safe client library
  • Declarative data modeling and migration system with Prisma Migrate
  • Beautiful data management workflows with Prisma Studio
3236 questions
34
votes
1 answer

Prisma : how can I find all elements that match an id list?

I am using Prisma with NextJs. In my API, I send to the back end a list of numbers that correspond to id's of objects in my database. As an example, if I receive the list [1, 2, 12], I would like to return the objects where the id is either 1, 2 or…
30
votes
8 answers

get full type on prisma client

When i generate my prisma client with prisma generate, i got an index.d.ts with all types from my database. But the probleme is that all type are "single" and there is no relations. When i query something like prisma.users.findMany({ …
dufaux
  • 681
  • 2
  • 8
  • 18
30
votes
7 answers

prisma - getting environment variable not found error message when running graphql query

I am getting this error message from prisma when I am running the GraphQL query. Environment variable not found: DATABASE_URL.\n --> schema.prisma:6\n | \n 5 | provider = \"postgresql\"\n 6 | url = env(\"DATABASE_URL\")\n |…
Sumchans
  • 3,088
  • 6
  • 32
  • 59
27
votes
2 answers

How to get enums in prisma client?

can I get a list of enums values of a model on the client-side like for select option? Sample enum enum user_type { superadmin admin user } I want this as a select-option on the client-side. How can I get them as JSON data?
t8101
  • 275
  • 1
  • 3
  • 5
27
votes
4 answers

How to upsert new record in Prisma without an ID?

I'm using Prisma (https://www.prisma.io) as ORM. I want to check for duplicates when store data and, if not exists, create a new record. I thought I could do that with upsert method provided by Prisma and available in the generated client, but the…
26
votes
5 answers

M1 Related! - Prisma: Can't reach database server at `database`:`5432`

Since I have moved to the new Apple Silicon architecture my docker setup with nextjs and postgres is not working anymore. The database inside the docker cannot be found by the nextjs server where I am using prisma. The prisma client can't reach the…
brstkr
  • 1,423
  • 3
  • 18
  • 28
24
votes
3 answers

docker and mysql: Got an error reading communication packets

I have a problem with connectivity in docker. I use an official mysql 5.7 image and Prisma server. When I start it via prisma cli, that uses docker compose underneath (described here) everything works. But I need to start this containers…
Terion
  • 2,396
  • 3
  • 28
  • 42
21
votes
13 answers

"Property does not exist" when I want to use model added in Prisma.schema

I'm working on ReactJS project with NextJS Framework and Prisma to manage connection and queries to the DB. On my local project the Support model is found and when I use it in my API and build my project it's ok. But when I push my project on…
Peter
  • 263
  • 1
  • 3
  • 7
21
votes
6 answers

@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again

I am using prisma, postgres, docker, kubernets. npx prisma migrate dev working. and npx prisma generate produce below output: ✔ Generated Prisma Client (2.23.0) to ./node_modules/@prisma/client in 68ms You can now start using Prisma Client in your…
Rafiq
  • 8,987
  • 4
  • 35
  • 35
20
votes
6 answers

Reason: `object` ("[object Date]") cannot be serialized as JSON. Please only return JSON serializable data types

I am using Prisma and Next.js. When I try to retrieve the content from Prisma in getStaticProps it does fetch the data but I can't pass it on to the main component. export const getStaticProps = async () => { const prisma = new PrismaClient(); …
richinrix
  • 434
  • 1
  • 3
  • 13
20
votes
4 answers

Difference between prisma db push and prisma migrate dev

what is the difference between prisma db push and prisma migrate dev ? When should I use one over the other. Docs say that prisma db push is about schema prototyping only and I don't understand what does that mean.
Ahmed Nawaz Khan
  • 1,451
  • 3
  • 20
  • 42
20
votes
3 answers

Run MySQL on Port 3307 Using Docker Compose

I am trying to create multiple Prisma database services on a single machine. I have been unable to create a MySQL database on a port other than 3306 using Docker Compose. docker-compose.yml version: '3' services: hackernews: image:…
Pasha
  • 333
  • 2
  • 3
  • 9
19
votes
2 answers

how to upsert many fields in prisma ORM

How can I upsert many fields in prisma ORM with one query? I don't want to use upsert fields one by one. Can I upsert all of them with one query?
xander
  • 201
  • 1
  • 2
  • 8
19
votes
3 answers

I want to use multiple database in prisma orm

I am not able to use multiple database in same application . How can we use multiple data sources. Can we generate multiple "schema.prisma" for different database connections.
18
votes
5 answers

prisma can't connect to postgresql

I've tried to connect Prisma with postgreSQL several times. prisma show this error message : "Error: undefined: invalid port number in…
sdy
  • 335
  • 1
  • 3
  • 10
1
2 3
99 100