Tyler Clendenin
12/22/2021, 5:03 PMupdateMany
, create
, upsert
) are they run in the order they appear in the object?Jay Bell
12/22/2021, 5:09 PMbinaryTargets = ["native", "linux-musl", "linux-arm-openssl-1.1.x"]
but then once we deploy to AWS we get
Error: Unknown PRISMA_QUERY_ENGINE_LIBRARY undefined. Possible binaryTargets: darwin, darwin-arm64, debian-openssl-1.0.x, debian-openssl-1.1.x, rhel-openssl-1.0.x, rhel-openssl-1.1.x, linux-arm-openssl-1.1.x, linux-arm-openssl-1.0.x, linux-musl, linux-nixos, windows, freebsd11, freebsd12, openbsd, netbsd, arm, native or a path to the query engine library.
We are using Prisma 3.0.1, I know this is older we cannot upgrade (without some more investigtion) because of this issue
https://github.com/prisma/prisma/issues/10512
We have multiple prisma schemas in our Nx repo and upgrading to the newest prisma seems to break them. cause it is looking in a hard coded spot for the schema.
Ideas?Eden Lane
12/22/2021, 6:24 PMprisma.post.update({
data: {
tags: [{
create: {
author: {
connect: {
id: authorId
}
},
tag: {
connect: {
id: tagId
}
}
}
}]
},
where: {
id: postId
}
})
xoldyckk
12/22/2021, 8:50 PMxoldyckk
12/22/2021, 8:51 PMGezim
12/23/2021, 3:36 AMprisma migrate dev --create-only
, Prisma asks me to reset the database in dev. Why is this happening?Neo Lambada
12/23/2021, 4:58 AMmodel Category {
id Int @id @default(autoincrement())
name String? @db.VarChar(255)
image String? @db.VarChar(400)
displayImage String? @db.VarChar(400)
parentId Int?
createdAt DateTime @default(now()) @db.DateTime(0)
updatedAt DateTime @default(now()) @db.DateTime(0)
//relationshops
parent Category? @relation(name: "Subcategories", fields: [parentId], references: [id])
subcats Category[] @relation(name: "Subcategories")
shops Shop[]
Product Product[]
}
Neo Lambada
12/23/2021, 4:59 AM{
id: 1,
name: 'Electornics and Mobiles',
image:'Electronics.jpg',
displayImage:'dvert-new.jpg',
parentId: 0,
},
Neo Lambada
12/23/2021, 4:59 AMawait prisma.category.createMany({ data: electronics })
Neo Lambada
12/23/2021, 5:00 AMawait prisma.category.createMany(
Foreign key constraint failed on the field: `parentId`
at cb (/app/node_modules/@prisma/client/runtime/index.js:38675:17) {
code: 'P2003',
clientVersion: '3.5.0',
meta: { field_name: 'parentId' }
}
Neo Lambada
12/23/2021, 5:00 AMsagar lama
12/23/2021, 5:04 AMmodel User {
id Int @id @default(autoincrement())
email String @unique
first_name String
last_name String
signup_token SignUpToken?
}
model SignUpToken {
id Int @id @default(autoincrement())
token Int
user User @relation(fields: [userId], references: [id])
userId Int @unique
created_at DateTime
updated_at DateTime @default(now())
}
Can the following two queries be combined into one?
const user = await this.prismaService.user.findFirst({
where: {
email: resendTokenInput.email
}
});
await this.prismaService.signUpToken.delete({
where: {
userId: user.id
}
});
Ahmed Osama
12/23/2021, 9:23 AMError validating: A self-relation must have `onDelete` and `onUpdate` referential actions set to `NoAction` in one of the @relation attributes. (Implicit default `onDelete`: `SetNull`, and `onUpdate`: `Cascade`) Read more at <https://pris.ly/d/cyclic-referential-actions>
I am using mysql with planetscale
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
referentialIntegrity = "prisma"
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
}
I am receiving the error on all relations (not only self-relations) which is weird. Also, the link given doesn't mention mysql (only mongodb and sql server)
The error was not there before, It showed up out of nowhere.hj yuiyui
12/23/2021, 2:29 PMexport function getGroupEventId(event_type, event_value){
return runQuery(
prisma.groupevent.findUnique({
where: {
event_type: event_type?.substr(0, 50),
event_value: event_value?.substr(0, 50),
}
})
)
}
I want to "select" a groupevent_id where his event_type and value are the same as parameters, how can i do that in prisma ?Tyler Clendenin
12/23/2021, 9:43 PMset
in an update on a many to many relationship, I'm getting the error The change you are trying to make would violate the required relation
, any ideas on why this would happen before I go down the rabbithole of recreation?Tyler Clendenin
12/23/2021, 10:09 PMconnectOrCreate
and deleteMany
rather than just a set
Tyler Clendenin
12/23/2021, 10:13 PMTyler Clendenin
12/23/2021, 10:18 PMMaciek K
12/23/2021, 10:23 PMTyler Clendenin
12/23/2021, 10:24 PMSpencer Kifell
12/24/2021, 4:38 AMarnu515
12/24/2021, 7:30 AMarnu515
12/24/2021, 7:30 AMxoldyckk
12/24/2021, 1:07 PMxoldyckk
12/24/2021, 1:55 PMLevi
12/24/2021, 1:56 PMxoldyckk
12/24/2021, 1:57 PMmodel Like{
likedOn ModelType @relation(fields: [likedOnId], references: [id])
likedOnId String
}
enum ModelType{
Post
Comment
CommentReply
}
xoldyckk
12/24/2021, 1:57 PMxoldyckk
12/24/2021, 1:58 PMDan Shapir
12/24/2021, 7:27 PM