For questions about Version 2 of the Prisma ORM
Questions tagged [prisma2]
232 questions
3
votes
1 answer
How to target a field in Prisma and get a flat array of values rather than an array of objects
I just started using Primsa 2 so I am still a noob at this but all I am trying to do is create a flat array of strings(Array) based on the values I get from a specific field. Right now when I target that field it gives me an array of objects…

Brady Edgar
- 486
- 7
- 27
3
votes
1 answer
How do you declare a database default in prisma using @default and degenerated()?
would like to declare a default binary value in the resulting sql migration file.
I have tried using @default(dbgenerated(“UUID_TO_BIN(uuid())”) but the expression does not get implemented in the resulting SQL file.

Mnengwa
- 217
- 4
- 10
3
votes
1 answer
graphql query with args not working for user id
I am bamboozled. I initially created the user query and it was giving me errors that I assumed were syntax errors. But then I created an identical query for vehicles which works perfectly. I have a suspicion that it's related to the ID! type but I…

Ani T
- 65
- 2
- 6
3
votes
2 answers
prisma2 migrate Error: There are more migrations in the database than locally
I am building backend app using prisma2 + typescript + nexus + graphql-yoga. I have defined my schema now while trying to save migrate by running command:
prisma2 migrate save --name "init" --experimental
Getting the following error.
Error: There…

ganesh deshmukh
- 314
- 4
- 17
2
votes
1 answer
Getting 'CreateVerificationTokenError' while signing in via EmailProvider with Prisma + Next-Auth
While using next-auth and prsima adapter I trying to use the email provider. I have a sign in "Header" that when pressed it opens up the /signin page just fine. When signing in via email provider though it doesn't work with an error message as…

Simon Palmer
- 384
- 1
- 2
- 13
2
votes
1 answer
Prisma: Is there a way to use DATE functions in prisma without raw query?
I have the below query and was wondering if it is possible to convert it into a prisma query or would I have to use raw queries itself?
SELECT
EXTRACT(DAY FROM MAX(joindate) - CURRENT_DATE AS DateDifference
TO_CHAR(date_of_implementation, 'Mon') as…

Teknoville
- 459
- 1
- 7
- 18
2
votes
0 answers
Error in connector: missing field `info` - Prisma Introspection (npx prisma db pull)
I have created an Express, Apollo GraphQL server which accepts requests and returns data from a MongoDB database via Prisma.
I have tested my application with a simple database from MongoDB Atlas and it all seems to work fine.
Now that I know…

nopassport1
- 1,821
- 1
- 25
- 53
2
votes
1 answer
what all access permission are required for prisma orm
I'm integrating prisma with nestjs
I want to know all the basic database user permissions required for prisma commands like migrate i.e. pull/push/deploy/dev etc.
We do not wish to give complete admin access and only wish to assign a few…

Siddhesh Nayak
- 185
- 3
- 15
2
votes
1 answer
Is it possible to make a join query with Prisma without a foreign key?
I've been struggling with this for a while but with no success.
I have two tables that might have a relation but not necessarily.
FIRST
+----+-----------+------------+
| ID | LPR | TIMESTAMP |
+----+-----------+------------+
| 1 | QWE123RTY…

V. S.
- 43
- 1
- 7
2
votes
4 answers
Single instance Prisma client autocomplete not working
I have a single instance prisma but it's not auto-completing any queries.
const { PrismaClient } = require("@prisma/client");
let prisma;
if (process.env.NODE_ENV === "production") {
prisma = new PrismaClient();
prisma.$connect();
} else {
if…

Robbi
- 151
- 2
- 6
- 14
2
votes
1 answer
Nested writes in Prisma orm
My schema looks like this:
model Transaction {
id BigInt @id @default(autoincrement())
description String? @db.VarChar(256)
category Category? @relation(fields: [categoryId], references: [id])
…

Elder Lucas
- 21
- 2
2
votes
2 answers
Nestjs with prisma cannot find module
I think it's a typescript compilation problem but I'm still learning typescript. Here is some context, I'm using nestjs, prisma and vegardit/prisma-generator-nestjs-dto to create some rest cruds. I made a self relation of one to many but when I…

Manuel Galván
- 21
- 1
- 3
2
votes
1 answer
Prisma findMany with 2 fields from array
I am using Prisma and I have two field values that I want to search on
const requests = [{ id, cid }, { id, cid }, { id, cid }];
I want to search on both fields together but for many.
for(request of requests) {
prisma.user.findFirst({
…

Vinit Khandelwal
- 490
- 8
- 20
2
votes
2 answers
How to seed with relationships in Prisma
I'm playing around with seeding in Prisma and I'm struggling to find examples that aren't super basic. In the example below, I want to create a User (author) who has authored multiple Services (1:n) and each Service has can come from one…

kevin
- 2,707
- 4
- 26
- 58
2
votes
0 answers
Prisma.io Is there a way to AND two ORs in prisma.findMany
I am trying to do some more complex query like this using prisma.io:
prisma.someModel.findMany({
where: {
AND: [
{
OR: [
{ firstName: { contains: 'John' } },
{ lastName: { contains: 'John' } }
…

Stanislau Stankevich
- 21
- 1