> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqlbuild.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Enum Model Contracts

> Use an enum as a portable model-column domain with generated accepted-value validation.

An enum can describe the allowed domain of a model column as well as provide individual SQL
literals.

These are separate uses:

* `@enum("market_type").WIN` inserts one validated value into SQL.
* `type market_type` declares that a model column uses the complete enum domain.

## Declare an enum-typed column

Use the enum name as the column type:

```sql theme={null}
MODEL (
  contract enforced,
  columns (
    market_type (type market_type),
  ),
);
```

SQLBuild does not send `market_type` to the warehouse as a physical type and does not create a
warehouse-native enum. It translates the enum into portable column metadata:

| Enum values                       | Physical column type | Generated validation                    |
| --------------------------------- | -------------------- | --------------------------------------- |
| Strings such as `WIN` and `PLACE` | `VARCHAR`            | `accepted_values` for the enum strings  |
| Integers such as `1` and `3`      | `INTEGER`            | `accepted_values` for the enum integers |

## Contract behavior

With `contract enforced`, SQLBuild runs the generated `accepted_values` audit with the model's other
audits. Its severity and timing follow the model's ordinary audit and materialization settings.

With `contract none`, SQLBuild still resolves the enum to its portable scalar column type but does
not generate the domain audit.

This behavior is the same on adapters with and without native enum support. The physical warehouse
column remains an ordinary string or integer column.

Changing the members of an enum-typed contract changes the model's contract identity and generated
validation.
