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 schema › Enums tab
Before you start¶
Creating and editing enums needs Read/Write access to the schema.
Where enums come from¶
- You create them on the
Enumstab, 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
CHECKconstraints in the source database into enums, shown asEnumrows 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¶
- Click
New Enum, or the edit button on a row. - Enter a
Name, for exampleOrderStatus. - Optionally add a
Description, or click the auto-generate button to draft one from the name and values. - Set
Use native ENUM type:- PostgreSQL generates
CREATE TYPE … AS ENUM. - MySQL generates an
ENUM('…')column type. - Other dialects always use a
CHECKconstraint, whatever this setting says.
- PostgreSQL generates
- Add values under
Values. Each value can have its own description. UseAdd Valuefor one at a time, orPaste Multiple...to paste a list, one value per line. - Reorder or remove values with the buttons on each row.
- 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¶
- Open the table, go to
Columns, and click the pencil icon on a text column (orAdd Column). - Tick
Constrain to allowed values. - Pick an
Enum, or clickCreate new enum...to define one on the spot. - 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.