Chris Packett
01/14/2022, 7:35 AMGreger gregerson
01/14/2022, 9:10 AMmodel Page {
text String @unique
bookId Int?
}
model Book {
pages Page[]
}
I'm wondering what is the reason for that and if I then create multiple books with the same page(s) what is the purpose of that?Stefan Bajić
01/14/2022, 10:36 AMschema.prisma
? Is there a way for me to allow these characters?esau
01/14/2022, 10:53 AMMoe Green
01/14/2022, 12:34 PMSELECT u.name, u.email FROM users AS u
that is, I want to say - selectively table columns? but - not all the columns that are in the tableAhos
01/14/2022, 12:56 PMcuid
yet.
Any idea how to solve this issue?
I was thinking to let TypeORM apply migrations instead prisma then I could run migrations using ts/js, but I am not sure if the community has already some alternative.
Thank youJ
01/14/2022, 3:21 PMJ
01/14/2022, 3:21 PMFrancesco Sardo
01/14/2022, 3:22 PMconst user = await prisma.user.create({data: {email: ''}})
const post = await prisma.post.create({data: {title: '', author: {connect: {id: user.id}}}})
const user = await prisma.user.create({data: {email: ''}})
const post = await prisma.post.create({data: {title: '', authorId: user.id}})
What's the difference between the two and why are both available?Johnson Detlev
01/14/2022, 3:49 PMmodel Thread {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
body String
user User @relation(fields: [userId], references: [id])
userId Int
likes Like[] @relation("ThreadsOnLikes")
}
model Like {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
user User @relation(fields: [userId], references: [id])
userId Int
thread Thread? @relation("ThreadsOnLikes", fields: [threadId], references: [id])
threadId Int?
comment Comment? @relation("CommentsOnLikes", fields: [commentId], references: [id])
commentId Int?
@@unique([userId, threadId, commentId])
}
And inside a resolver I want to for example delete a like from a user for a specific threadId like so:
await db.thread.update({
where: { id: input.id },
data: {
likes: {
delete: {
userId_threadId_commentId: { userId: session.userId, threadId: input.id },
},
}
}
})
But when I try to execute that mutation, prisma throws the following error:
Argument commentId for data.likes.delete.userId_threadId_commentId.commentId is missing.
When I add it to the delete argument with , commentId: null
it states this error:
Argument commentId: Got invalid value null on prisma.updateOneThread. Provided null, expected Int.
Although inside the database the comment_id field is actually null
. Is this a bug or how is this fixable?Julien Goux
01/14/2022, 9:03 PMJulien Goux
01/14/2022, 9:04 PMJulien Goux
01/14/2022, 9:04 PMJulien Goux
01/14/2022, 9:05 PMJulien Goux
01/14/2022, 9:05 PMJulien Goux
01/14/2022, 9:07 PMJulien Goux
01/14/2022, 9:09 PMJulien Goux
01/14/2022, 9:09 PMAlex Vilchis
01/14/2022, 9:44 PMEudes Tenório
01/15/2022, 2:33 AMWildan Alif R
01/15/2022, 1:34 PMChris Packett
01/15/2022, 5:41 PMnpx prisma migrate deploy
command?Chris Packett
01/15/2022, 5:42 PMBenny Kachanovsky
01/16/2022, 12:48 PMYazid Daoudi
01/16/2022, 2:01 PMMarvin
01/16/2022, 3:00 PMΓιώργος Κραχτόπουλος
01/16/2022, 7:39 PM$queryRaw()
generates 4 queries for one operation!? My example:
await prisma.$queryRaw`SELECT id FROM public.user`
Log output:
prisma:query SELECT id FROM public.user
prisma:query SELECT id FROM public.user
prisma:query SELECT id FROM public.user
prisma:query SELECT id FROM public.user
Related comment on GitHubbob
01/17/2022, 12:54 AMbob
01/17/2022, 12:55 AMInvalid `prisma.pool.findMany()` invocation:
Inconsistent query result: Field outputToken is required to return data, got `null` instead.
at cb (/home/pop/projects/freealpha/freealpha-api/dist/webpack:/freealpha-api/node_modules/@prisma/client/runtime/proxy.js:94:1)
Are we really not able to load large sets of data with many relations in one go?