Jacob Bohrtz
10/24/2022, 8:44 PMawait mydata.oppProject.updateMany({
where: {
ID: project.ID
},
data: {
ProjectNum: devnum
}
});
translated to:
UPDATE [dbo].[OppProject] SET [ProjectNum] = @P1 WHERE 1=1
Marcin Cebula
10/25/2022, 8:26 AMpreviewFeatures = ["referentialIntegrity"] ... relationMode = "foreignKeys"
should I be able to use NoAction
? The platform is throwing a P1012 with `Invalid referential action: NoAction
. Allowed values: (Cascade
, Restrict
, SetNull
).`
...that or the platform is broken. I updated all the NoAction
to something else and I see the Schema change in the SchemaViewer but the IDE is still throwing the same error with lines of code that no longer exist. ugh... 🙄Nicola Genesin
10/25/2022, 8:36 AMnpx prisma db pull
removes all virtual @relation
fields. We're using planetscale and following your guide here https://www.prisma.io/docs/getting-started/setup-prisma/add-to-existing-project/relational-databases/introspection-typescript-planetscaleDanny SMc
10/25/2022, 9:53 AMPerez cato Cato perez
10/25/2022, 10:27 AMnick
10/25/2022, 12:38 PMFederico
10/25/2022, 1:10 PMexport const activities: QueryResolvers['activities'] = async () => {
const activities = await db.activity.findMany({
include: {
author: true,
},
})
activities.forEach((activity) => {
activity.description = 'New description'
activity.author.firstname = 'Rob'
})
return activities
}
This works fine with the first field, while it doesn’t seem to have any effect on the second one.
Do you know if it possible to edit some fields of a nested object that was requested through an include?
I don't know if this is relevant, but I use graphql to send the result back to the client.
Thanks in advance!David Hancu
10/25/2022, 2:39 PM$unuse
, which will allow you to remove the middlewares that you've added previously.Sebastian M.D.
10/25/2022, 2:43 PMnick
10/25/2022, 6:02 PMPerry Raskin
10/25/2022, 7:18 PMAmgelo563
10/25/2022, 7:40 PMSebastian M.D.
10/25/2022, 8:15 PMDavid Hancu
10/25/2022, 8:23 PM$schema
field to all models, allowing you to get the DMMF data without having to use hacky ways. There's also another feature planned, which is quite massive:
Data input validation at runtime (This feature will have a proposal created for it as it is quite big)
Now for the important part, the 2 questions:
• What does your testing workflow with Prisma look like and what improvements can be made to it?
• Is there any feature that you're dying to see in Prisma but isn't on the roadmap?
Thanks in advance!Pat
10/25/2022, 9:14 PMCREATE UNIQUE INDEX lower_title_idx ON films(lower(title), author);
It feels like there may not be a way to do this in prisma syntax... is that correct?
@@unique([title, author])
but, you know, with LOWER
in there somehow. tia!Michael Jay
10/25/2022, 9:17 PMUser hasMany Posts
relation. What about a hasOne
?
I'm looking for all Widgets that DO have a Gizmo, where the relation is A Widget has zero or one Gizmo
Doable? Would it be:
await prisma.widget.findMany({
where: {
gizmo: {
is: {},
}
}
})
Nicola Genesin
10/25/2022, 9:51 PMnpx prisma db pull
removes all virtual @relation
fields. We're using planetscale and following your guide here https://www.prisma.io/docs/getting-started/setup-prisma/add-to-existing-project/relational-databases/introspection-typescript-planetscaleNathan Froese
10/25/2022, 10:30 PMDavid Hancu
10/25/2022, 10:45 PMDuckyDev
10/26/2022, 6:45 AMprisma introspect
, however, whoever made the database is not consistent with table and column names, sometimes a space
is used to separate words, another time _
is used, and all columns are ALL CAPITAL LETTERS.
Is there a way to let Prisma map
this to something sane to work with overtime automatically so I don’t have to do that myself?Akbar
10/26/2022, 10:24 AMTS: 4.8.4
Prisma: 4.4.0
Node: v16.15.0
Thanks a bunch!SKhan
10/26/2022, 12:06 PMenum Type {
ONEOFF
FREQUENT
}
model A {
type Type? @default(ONEOFF)
b B[]
...
}
model B {
a A? @relation(fields: [aId], references: [id], onDelete: Cascade)
aId String?
endDate Date?
...
}
How would I create a query to get:
• all data from model A
where type === "FREQUENT"
AND
• only get data from model B
where type === "ONEOFF"
& endDate === null
?
Will I have to create 2 queries for each scenario & then concat them?Dan Calise
10/26/2022, 2:27 PMapp
folder with Prisma? I’m not sure it will work as getServerSideProps
and getStaticProps
are no longer used. Seems like we’re forced to use fetch
Lukas Vogel
10/26/2022, 4:04 PMLukas Vogel
10/26/2022, 4:06 PMLukas Vogel
10/26/2022, 4:07 PMmodel product {
id Int @id @default(autoincrement())
stripeId String
artikelNr String
name String
active String
description String?
image String?
hersteller String?
category String?
subcategory String?
stripePriceId String
price Int
currency String
}
Gezim
10/26/2022, 4:24 PMGezim
10/26/2022, 4:24 PMKay Khan
10/26/2022, 6:03 PMJordan
10/26/2022, 6:11 PM