Skip to content

Commit

Permalink
Update website/docs/reference/resource-properties/constraints.md
Browse files Browse the repository at this point in the history
  • Loading branch information
nataliefiann authored Sep 20, 2024
1 parent ae4887d commit 66b456d
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion website/docs/reference/resource-properties/constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,38 @@ Here are some examples showing how the new syntax is used:
```yml
models:
models:
- name: <model_name>
# required
config:
contract:
enforced: true
# model-level constraints
constraints:
- type: primary_key
columns: [FIRST_COLUMN, SECOND_COLUMN, ...]
- type: FOREIGN_KEY # multi_column
columns: [FIRST_COLUMN, SECOND_COLUMN, ...]
expression: "OTHER_MODEL_SCHEMA.OTHER_MODEL_NAME (OTHER_MODEL_FIRST_COLUMN, OTHER_MODEL_SECOND_COLUMN, ...)"
- type: check
columns: [FIRST_COLUMN, SECOND_COLUMN, ...]
expression: "FIRST_COLUMN != SECOND_COLUMN"
name: HUMAN_FRIENDLY_NAME
- type: ...
columns:
- name: FIRST_COLUMN
data_type: DATA_TYPE
# column-level constraints
constraints:
- type: not_null
- type: unique
- type: foreign_key
expression: OTHER_MODEL_SCHEMA.OTHER_MODEL_NAME (OTHER_MODEL_COLUMN)
- type: ...
```
Expand Down

0 comments on commit 66b456d

Please sign in to comment.