notiz-dev / prisma-dbml-generator

Prisma DBML Generator
MIT License
684 stars 37 forks source link

Should @id annotated columns be marked as not null? #55

Open yuhsak opened 3 months ago

yuhsak commented 3 months ago

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