LanguageEnums and encryption

Enums and encryption

Two modifiers say what a column holds and how it is stored.

Enums

enum(...) lists the values a column may hold. Values are names or numbers.

orders.erdOpen in playground
table orders {
  id        bigint   pk
  status    varchar  enum(PENDING, PAID, CANCELED)
  priority  int      enum(0, 1, 2)
}
The diagram resin draws for orders.erdThe diagram resin draws for orders.erd

Write only values the schema or its comments support: an enum in resin is a statement about the data. The values show in the playground's side panel and in the column card, and the diagram tags the column ENUM.

Encryption

enc says a column is stored encrypted.

members.erdOpen in playground
table members {
  id     bigint        pk
  name   varchar(100)  enc
  phone  varchar(20)?  enc  "Mobile number"
}
The diagram resin draws for members.erdThe diagram resin draws for members.erd

The diagram tags it ENC.