Jonathan Marbutt
10/07/2022, 2:52 PMPrisma.dmmf.datamodels.models
Jonathan Marbutt
10/07/2022, 2:53 PMdocumentation
property in the schema that is returned from the dmmfJonathan Marbutt
10/07/2022, 3:00 PMJonathan Marbutt
10/07/2022, 3:00 PMMike Willbanks
10/07/2022, 4:32 PMdelete
if it is the primary key right? More details in 🧵Slackbot
10/08/2022, 4:23 AMTimothy Choi
10/08/2022, 11:46 AMAnton Wester
10/08/2022, 11:52 AMDibas Dauliya
10/08/2022, 1:47 PMtags: [ { tag: { title: 'tag-1' } }, { tag: { title: 'tag-2' } } ],
in every posts. I want to filter the post based on the tag, and I did following method but it is not returning expected posts.
const data = await prisma.post.findMany({
where: {
tags: {
every: {
tag: {
title: tagTitle,
},
},
},
},
...
})
Anton Johansson
10/08/2022, 1:49 PMnpx prisma generate
puts generated code in ./node_modules/.prisma/client
. Is it possible to put the generated code in two different directories? And somehow have new PrismaClient();
know which one I want to create it for?Rohan Rajpal
10/08/2022, 2:22 PMA
has one to many relation with B
Now if I want the records in A
which have less than 3 records linked to B
, what will be the query in prisma?
Looking to do something like this
this.prisma.A.findMany({ where: { b : { count: { lt: 3 } } } })
N
10/08/2022, 6:24 PMN
10/08/2022, 6:24 PMN
10/08/2022, 6:24 PMN
10/08/2022, 6:25 PMJijin P
10/09/2022, 10:52 AMut dev
10/09/2022, 11:13 AMmodel Customer {
id String @id @default(cuid())
userId String
companyId String? @unique
salutation String
firstname String
lastname String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
bankAccount BankAccount?
company Company[]
}
I want to return the foreign key data aswell so I am doing this in my findMany
getAll: t.procedure.query(({ ctx }) => {
return ctx.prisma.customer.findMany({
include: {
company: true,
bankAccount: true
}
});
}),
But I still get an error that my casing is wrong?
next-dev.js?a272:20 TRPCClientError:
`Invalid prisma.customer.findMany()
invocation:`
{
include: {
company: true,
~~~~~~~
bankAccount: true,
~~~~~~~~~~~
? projects?: true,
? invoices?: true,
? files?: true,
? user?: true,
? BankAccount?: true,
? Company?: true,
? _count?: true
}
}
FUTC
10/09/2022, 3:17 PMnode:18.8.0
image instead of an alpine image and using the node_modules folder from the host system previously solved my issues. But when I try to run our jest e2e tests I get Error: Unknown binaryTarget linux-arm64-openssl-undefined and no custom engine files were provided
. It’s weird that this only happens when trying to run the e2e tests, and otherwise everything seems to work fine. Does anybody have an idea how I could fix this?Sebastian Gug
10/09/2022, 5:55 PMHaris Mehrzad
10/09/2022, 11:20 PMmodel Starboard {
id String @id @default(cuid())
guildId String
channelId String
starEmoji String
embedColor String
minimumStarCount Int
messagesInStarboard MessageInStarboard[]
@@unique([channelId, starEmoji])
@@map("starboards")
}
model MessageInStarboard {
messageId String @id
authorId String
starboardId String
starboardMessageId String
starboard Starboard @relation(fields: [starboardId], references: [id], onDelete: Cascade)
userStarsOnMessage UserStarOnMessage[]
@@map("messages_in_starboard")
}
model UserStarOnMessage {
emoji String
userId String
authorId String
guildId String
channelId String
messageId String
starboardId String
starredMessageId String?
starboardMessage MessageInStarboard? @relation(fields: [starredMessageId], references: [messageId], onDelete: Cascade)
@@id([messageId, userId])
@@map("stars_on_messages")
}
However, when I try to run an updateMany()
seen below.
this.client.prisma.userStarOnMessage.updateMany(
{
where: {
messageId: fetchedMessaged.id,
starredMessageId: null
},
data: {
starredMessageId:
messageAlreadyStarred.starboardMessageId
}
}
)
I get the following error.
PrismaClientKnownRequestError:
Invalid `prisma.userStarOnMessage.updateMany()` invocation:
Foreign key constraint failed on the field: `stars_on_messages_starredMessageId_fkey (index)`
at RequestHandler.request (/Users/polar/Projects/starboard/node_modules/.pnpm/@prisma+client@3.15.2_prisma@3.15.2/node_modules/@prisma/client/runtime/index.js:49022:15)
at async PrismaClient._request (/Users/polar/Projects/starboard/node_modules/.pnpm/@prisma+client@3.15.2_prisma@3.15.2/node_modules/@prisma/client/runtime/index.js:49919:18)
at async Promise.all (index 0)
at async Promise.all (index 0)
at async MessageReactionAdd._run (file:///Users/polar/Projects/starboard/dist/lib/classes/EventHandler.js:30:20) {
code: 'P2003',
clientVersion: '3.15.2',
meta: { field_name: 'stars_on_messages_starredMessageId_fkey (index)' }
}
Faizan
10/10/2022, 8:43 AMError: Failed to convert napi `string` into rust type `String`
With the following prisma versions
"dependencies": {
"@prisma/client": "^3.15.2",
"prisma": "3.15.2"
}
What is weird is that the exact code works on a teammate's system.Nurul
10/10/2022, 10:09 AMFirat Özcan
10/10/2022, 11:08 AMwhere
argument in a include for a one-to-one relation?
I am having this query and for access control I want to add a where clause but it's not typed and I guess this also means that it wont be executed if I just add it there
prisma.invoiceLine.findMany({
include: {
Track: {
where: accessibleBy(user).Track, // This is what I need but it doesnt exist
select: {
Name: true
}
}
}
})
Firat Özcan
10/10/2022, 11:08 AMinvoiceLine
has a one-to-one relation to TrackFirat Özcan
10/10/2022, 11:10 AMRaimond Lume
10/10/2022, 12:45 PMRelationFilter
type loses the null
option for a model after a seemingly unrelated schema update.
What I changed in the schema: I added a new m-to-m model, which references the table Solution
. Nothing changed in the model for the Solution
itself.
I’ve attached screenshots of the type before (1st screenshot) and after (2nd screenshot)
Why did the type change?
For context, I was using isNot: null
to filter on null relations before, which stopped working suddenly - that’s where I discovered the type issue
Using client v4.4.0, TS v4.83Rinil Kunhiraman
10/10/2022, 2:04 PMReo Yamashita
10/10/2022, 2:11 PMjt
10/10/2022, 3:26 PM