0

I am following a youtube tutorial, and this is the first time ive used Prisma. My simple question is, what is the difference if you do for example: store Store @relation("StoreToCategory", fields: [storeId], references: [id]) vs billboard Billboard @relation(fields: [billboardId], references: [id]) where you dont add a "tag" like "BillBoardToCategory" what happens/changes when you dont add that tag?

  • 1
    The name argument of @relation (for example, "StoreToCategory" in your first example) is optional. It is called a relation name and it's used to disambiguate relationships when a model relates to itself, or when there are multiple relationships between two models. If a model only has one relation to another model, you can omit the relation name. This is why you can define the relation to Billboard without a relation name in your example. – Nurul Sundarani Jul 18 '23 at 21:11

0 Answers0