Schemas

Work with enums

An enum is a named list of allowed values, such as OrderStatus with New, Paid, Shipped and Cancelled. Constrain a column to an enum and Kenseme generates the matching rule for your dialect: a native enum type where the database has one, or a CHECK constraint.

In the app: Data Model › Schemas › your schemaEnums tab

[screenshot]
The Enums tab listing enums with their values, Used By counts and Strategy.

Before you start

Creating and editing enums needs Read/Write access to the schema.

Where enums come from

  • You create them on the Enums tab, or from a column’s edit dialog.
  • Script imports create them from columns limited to a list of values, such as CHECK (Status IN ('New','Open','Closed')) or a PostgreSQL enum type. See What schema import does.
  • Connection imports turn value-list CHECK constraints in the source database into enums, shown as Enum rows you can accept or skip. See Import objects from a database connection.

Only simple value lists become enums. Ranges, rules across columns, and function calls stay as ordinary constraints.

The Enums tab

The grid shows each enum’s Name, a preview of its Values, Used By (how many columns reference it), its Strategy (ENUM or CHECK) and when it was Updated. Each row has edit and delete buttons. Generate Descriptions writes AI descriptions for the selected enums.

Create or edit an enum

  1. Click New Enum, or the edit button on a row.
  2. Enter a Name, for example OrderStatus.
  3. Optionally add a Description, or click the auto-generate button to draft one from the name and values.
  4. Set Use native ENUM type:
    • PostgreSQL generates CREATE TYPE … AS ENUM.
    • MySQL generates an ENUM('…') column type.
    • Other dialects always use a CHECK constraint, whatever this setting says.
  5. Add values under Values. Each value can have its own description. Use Add Value for one at a time, or Paste Multiple... to paste a list, one value per line.
  6. Reorder or remove values with the buttons on each row.
  7. Click Save.

A name and at least one value are required. When you edit an enum that columns already use, the dialog lists them under Used by N columns, with links.

Constrain a column to an enum

  1. Open the table, go to Columns, and click the pencil icon on a text column (or Add Column).
  2. Tick Constrain to allowed values.
  3. Pick an Enum, or click Create new enum... to define one on the spot.
  4. The dialog previews the values. Click Save Changes.

The option only appears for string data types.

Delete an enum

Click the delete button on its row and confirm. The confirmation says you can restore it within 30 days.

You can’t delete an enum that columns still use. Kenseme refuses with Cannot delete enum '…' — it is still assigned to N column(s). Untick Constrain to allowed values on those columns first.