For questions about Version 2 of the Prisma ORM
Questions tagged [prisma2]
232 questions
0
votes
1 answer
NestJS Prisma: start application even if prisma can't connect to database
I'm trying to prevent prisma from from shutting my app down even if it fails to connect to the database, so that my health-check endpoint can still be reached. The error I get is this:
throw new…

rymanso
- 869
- 1
- 9
- 21
0
votes
2 answers
Disconnecting a Many to Many Relation in Prisma
So, I asked this question yesterday and a user on here was kind enough to point me in the right direction when using explicit many-to-many relations in Prisma.
From that accepted answer I was able to update the relation using the Connect…

dpstudio
- 147
- 3
- 10
0
votes
1 answer
Using explicit Many to Many Relation in Prisma
I have the following User and Group models that share a many-to-many relation:
model User {
id String @id @default(uuid())
email String @unique
groups UsersGroups[]
@@map("user")
}
model Group…

dpstudio
- 147
- 3
- 10
0
votes
1 answer
Flyway vs Prisma Migrations
I'm migrating an existing TypeORM + PostgresQL project from TypeORM to Prisma. This existing project was handling migrations with Flyway: I wrote the SQL scripts to change the DB and those script were executed against de DB via Flyway. Now that I'm…

Juan Chaves
- 81
- 1
- 4
0
votes
2 answers
Seeding with prisma nested create with one-to-one relation
Currently working on a project to learn a bit more about prisma with nestjs. But cant get the schema to work. The seed wont go through because the flat depends on the owner field, that can only be filled with the created user.
I wanted to create a…

Flo Gesell
- 7
- 6
0
votes
0 answers
How to count Number of queries passed from prisma client?
I'm using node as backend for my application. And postgresql as database. For accessing database I'm using Prisma But now I'm really worried about the DB hit on each API calls. So is there any method to find number of queries passed through prisma…

Abhiram V V
- 23
- 5
0
votes
2 answers
Why items repeat in Prisma pagination with orderBy?
The data looks as follows:
13 users with id's 2-13. User 2 got 2 likes, user 10 got 2 likes, user 3 got 1 like. The rest didn't get any likes.
Prisma query looks like this:
return this.prisma.user.findMany({
skip: Number(page) * Number(size),
…

Mateusz Piwowarski
- 559
- 1
- 6
- 15
0
votes
1 answer
Prisma Explicit Many to Many - how to delete item without deleting user
My use case is simple:
There's users
Users can create workspaces
Users can delete workspaces
User gets a role on each workspace (OWNER, ADMIN, MANAGER, VIEWER)
The problem:
This requires an explicit many-to-many relation (users <->…

aivarastee
- 81
- 2
- 12
0
votes
2 answers
Trouble using "Integer" type in Prisma ORM schema for MongoDB
I'm trying to create a model in Prisma, following the tutorial, which unfortunately doesn't show how to use a wider variety of MongoDB types.
I see a lot of types in the documentation. For example, I tried using the Integer field as…

nicb
- 191
- 2
- 10
0
votes
1 answer
graphql with prisma use where in update func with relation field
schema.prisma file I need help how can I update a post based on 2 conditions? The user id that I get from userId which belongs to user tab and post id which belongs to on other post table
updatePost: async (parant, args, context) => {
const {…

amgoun
- 1
- 3
0
votes
1 answer
Add a contact with by using self relation with prisma
I have the following prisma schema
model User {
userId Int @id @default(autoincrement())
registeredAt DateTime @default(now())
firstName String @db.VarChar(250)
lastName String @db.VarChar(250)
email …

Marcel Dz
- 2,321
- 4
- 14
- 49
0
votes
1 answer
how to fetch mapped columns in prisma2
I am new to prisma2 and I have created the below model schema with @map annotation
model User {
id Int @id @default(autoincrement())
name String @map("user_name")
}
Now when i see in my db I am having two columns in User table id and user_name…

lazyCoder
- 2,544
- 3
- 22
- 41
0
votes
1 answer
How can I filter a table by a nested array of objects property with prisma?
So I have a table with a json field, and that field has a nested field which is an array of objects. I'm trying to filter the rows by the nested array of objects to basically get rows where the nested array of object contains an object with a…

P.Y Ofori
- 5
- 4
0
votes
1 answer
Prisma get data with foreign key in sqlite DB
I have an SqlLite database that contains these models
model Product {
id Int @id @unique(map: "sqlite_autoindex_products_1") @default(autoincrement())
label String
description String?
price …

infodev
- 4,673
- 17
- 65
- 138
0
votes
1 answer
How to type GraphQLInputObjectType with prisma 2 types
I have a problem with typing GraphQLInputObjectType. I can't find a way to inherit Prisma 2 types.
There is no problem when I type them manually for create, delete and other similar inputs, but prisma 2 has some very complex filters that are hard to…

SlothOverlord
- 1,655
- 1
- 6
- 16