Skip to content

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

Open
@yuhsak

Description

@yuhsak

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions