Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yuhsak opened this issue Aug 22, 2024 · 0 comments
Open

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

yuhsak opened this issue Aug 22, 2024 · 0 comments

Comments

@yuhsak
Copy link

yuhsak commented Aug 22, 2024

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?

if (field.isRequired && !field.isId) {
columnDefinition.push(DBMLKeywords.NotNull);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant