Hey I am trying to create a simple followers and f...
# prisma-whats-new
p
Hey I am trying to create a simple followers and following logic on type User but it doesn’t work =/ This is what my model looks like
Copy code
type User {
  id: ID! @unique
  createdAt: DateTime!
  username: String! @unique
  following: [User!]!
  followers: [User!]!
}
And when I do prisma deploy I get User ✖️ The relation field
following
must specify a
@relation
directive:
@relation(name: "MyRelation")
✖️ The relation field
followers
must specify a
@relation
directive:
@relation(name: "MyRelation")
If I edit the model to look like
Copy code
type User {
  id: ID! @unique
  createdAt: DateTime!
  username: String! @unique
  following: [User!]! @relation(name: "Following")
  followers: [User!]! @relation(name: "Followers")
}
I get UnhandledPromiseRejectionWarning: Error: Whoops. Looks like an internal server error.
Hmm, I did prisma local nuke and then prisma deploy and it worked
t
@pnicolaou I am new to Prisma, can you please share what a "prisma local nuke" means and/or does and how you do it? Sorry for the newbie question. I know I need something similar to this and was curious if I run into the same issue as you. Thanks for sharing!
p
Hey, sorry just saw this. prisma local nuke, destroys the database and recreates it (it also uses the seed.graphql file to populate the database with default values). Note after you use that command you need to run prisma deploy again! Think of it, like running prisma for the first time! 🙂
t
@pnicolaou thanks for your input. Much appreciated.
p
No problem. If you still don’t understand let me know. And ill try explain again! 🙂