Manish
03/15/2021, 2:40 AMMitchell
03/15/2021, 4:14 PMwarn(prisma) @prisma/cli has been renamed to prisma.
Please uninstall @prisma/cli: npm remove @prisma/cli
And install prisma: npm i --save-dev prisma
Stephen Jensen
03/16/2021, 3:49 AMUser
model where it can have friends who are also users.
About 5 months ago I saw a nice explanation by @Ryan where he said we could use the following model:
model User {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
friends Relationship[]
}
model Relationship {
id String @id @default(cuid())
user User? @relation(fields: [userId], references: [id])
userId String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
I think the thing that would clear this up for me would be to see example prisma create commands that would show how to take 2 users and first create a relation from user1 -> user2
and then how to do the back relation. I'll start- thanks so much!
const user1 = await prisma.user.create({ data: { id: "1" } })
const user2 = await prisma.user.create({ data: { id: "2" } })
const relationship1To2 = await prisma.relationship.create({ //?? })
const relationship2To1 = await prisma.relationship.create({ //?? })
(My confusion stems from the fact that it seems like if we create a relationship where we set user1.id
to userId
, we will establish the relationship between user1->friendship
but not back to user2
.)nikolasburk
03/16/2021, 5:15 PMMitchell
03/16/2021, 5:44 PMnpx prisma migrate dev --preview-feature
I see this message in the console:
migrate dev is not a prisma command.
▸ Perhaps you meant generate
Sequential
03/16/2021, 5:51 PMMartïn
03/16/2021, 6:06 PMPhilipp Rajah Moura Srivastava
03/16/2021, 6:36 PMANISH AGGARWAL
03/16/2021, 10:54 PMgraphql-yoga
but due to update in Chrome, it doesn't allow to persist cookie
by sameSite
which can be fixed by https://github.com/prisma-labs/graphql-yoga/issues/623
I would be happy to contribute to fix it if the mentor aggrees, and community is active.
Thanks!🙂Yilmaz Ugurlu
03/17/2021, 10:46 AMRalf Vogler
03/17/2021, 4:26 PMprisma db push
so far, now prisma migrate dev
wants to reset the database but I already have data in it. How can I keep it or easily copy it?Daniel Snell
03/17/2021, 4:34 PMMike Cavaliere
03/17/2021, 4:45 PMDmitry Petrov
03/17/2021, 5:28 PM"ts-node": "ts-node --compiler-options '{\"module\":\"CommonJS\"}'"
to package.json/scripts
to allow it to run. Prior to 1.18.0 I was using the workaround suggested in this GitHub issue by elkevinwolf. All was working fine on my local dev environment, but I’m getting errors when I try to do this as part of a Vercel build. The seed.ts
file references other lib files in our codebase, almost all of which are ES6 modules. We also have baseUrl set to .
in tsconfig.json
– though I think I’ve been able to work around that. I feel that this is a result of my knowledge gap in how modules and compilers function – but since I reference ES6 modules and they have import statements, etc. all with absolute imports utilizing the basePath, things break as those functions get invoked. I’m sorry if this is somewhat vague, happy to provide code examples/errors/etc. – just want to make sure I provide what’s useful.Mike Cavaliere
03/17/2021, 5:29 PMpackage.json
to toggle migration commands when deploying? I.e. to run prisma migrate dev
vs prisma migrate deploy
dependent on environment (preview vs prod)?Mitchell
03/17/2021, 5:53 PM“code”: “INTERNAL_SERVER_ERROR”
“Argument id for data.postedBy.connect.id must not be null. Please use undefined instead.\n”Looks like it’s a problem in:
/@prisma/client/runtime/index.js:32448:19
Mitchell
03/17/2021, 10:05 PMUnhandled Rejection (Error): Argument id for data.postedBy.connect.id must not be null. Please use undefined instead.I’m guessing this because you need to be logged in before you can post? Is it possible to modify the server code to allow
postedById
to be undefined or null?Thomas Georgiadis
03/17/2021, 10:56 PMconst update = await prisma.user.update({
where: {
id: 6,
},
data: {
posts: {
update: [
{
where: {
id: 9,
},
data: {
title: 'Posts 9 title',
},
},
{
where: {
id: 10,
},
data: {
title: 'Post 10 title is different',
},
},
]
},
},
})
Sergio Bilello
03/18/2021, 3:50 AMKha
03/18/2021, 7:00 AMpropagandalf
03/18/2021, 7:34 AMPost
and User
models."Justin
03/18/2021, 7:50 AMmxstbr
03/18/2021, 9:41 AMJulien Goux
03/19/2021, 10:11 AMJulien Goux
03/19/2021, 10:11 AMNicolas Toulemont
03/19/2021, 10:13 AMJulien Goux
03/19/2021, 10:13 AMJulien Goux
03/19/2021, 10:14 AMJulien Goux
03/19/2021, 10:16 AMNicolas Toulemont
03/19/2021, 10:16 AM{
"en": {
"title": "Content"
},
"fr": {
"title": "Contenu"
}
}