prisma-dbml-generator icon indicating copy to clipboard operation
prisma-dbml-generator copied to clipboard

Should @id annotated columns be marked as not null?

Open yuhsak opened this issue 1 year ago • 0 comments

I noticed that id columns are displayed as if it's nullable when deployed to dbdocs.

image

For example, this prisma schema produces such dbml modeling which lucks not null annotation for user_id column.

Input: schema.prisma

model User {
  user_id Int    @id
  name    String
}

Output: schema.dbml

Table User {
  user_id Int [pk]
  name String [not null]
}

I thought it's bit confusing, but is that somehow a designed behavior?

https://github.com/notiz-dev/prisma-dbml-generator/blob/955d62a3c34f2d5028902af3acf349cc1e91c60a/src/generator/table.ts#L114-L116

yuhsak avatar Aug 22 '24 17:08 yuhsak