LanguageNullability

Nullability

Every column is NOT NULL unless its type ends in ?.

users.erdOpen in playground
table users {
  id          bigint        pk
  email       varchar(255)  uk
  nickname    varchar(50)?  "Shown next to comments"
  deleted_at  datetime?
}
nickname and deleted_at may be empty; the card marks them NULLnickname and deleted_at may be empty; the card marks them NULL

A column without ? is a claim, not a default you forgot to fill in: resin reads it as NOT NULL, draws it so, and uses it to work out relations.

In the diagram

A nullable column is marked NULL after its type, as in DDL. A card with any nullable column keeps a narrow column for the mark, so the types stay aligned. A nullable reference also marks its connector: a ring and 0..1 at the referenced table's end. In the playground's side panel the Null column says NULL or NOT NULL for every column.

Keys and references

A primary key cannot be nullable. resin reports primary key ... cannot be nullable, with a hint to remove the ?.

On a referencing column, ? makes the parent optional: a row may have no parent at all. See Must a parent exist?.