[SOLVED] Reducing Unnecessary Link Tables?


Using Prisma 1.30, If I create a basic schema like the one below, it seems to generate a link table. This feels unnecessary since the relation is not many - to - many. Is there a way to force the use of the inline id versus the creation of a link table?

type User {
  id: UUID! @unique
  displayName: String!
  updatedAt: DateTime!
  createdAt: DateTime!
  comments: [Comment!]! @relation(name: "UserComment", onDelete: CASCADE)

type Comment {
  id: UUID! @unique
  content: String!
  createdAt: DateTime!
  user: User! @relation(link: INLINE, name: "UserComment")


@Flash619 Think you might need Prisma 1.31-beta:

type User @db(name: "user") {
  id: ID! @id
  createdAt: DateTime! @createdAt
  email: String! @unique
  name: String
  role: Role @default(value: USER)
  posts: [Post!]!
  profile: Profile @relation(link: INLINE)


Yes, you can define the relational strategy in the new datamodel. That will help reduce link tables



Following the usage of the ‘link’ parameter as in my example above, still results in a link table being created.


@Flash619 are you using Prisma 1.30? datamodel v1.1 is available in Prisma 1.31-beta



I’m using the image prismagraphql/prisma:1.31-beta in my docker-compose.yml and have the same version installed locally, confirmed with prisma --version.


Additionally I’ve noticed Prisma seems to forcibly be adding createdAt and updatedAt fields to every model whether these fields are defined or not.


The fix was to enable the prototype flag in the docker compose file as seen here.