From 66b456d5fa59693d1e0af6b51361783e74e194ea Mon Sep 17 00:00:00 2001 From: nataliefiann <120089939+nataliefiann@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:25:01 +0100 Subject: [PATCH] Update website/docs/reference/resource-properties/constraints.md --- .../resource-properties/constraints.md | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/website/docs/reference/resource-properties/constraints.md b/website/docs/reference/resource-properties/constraints.md index 7eae7ab53db..099953fc53c 100644 --- a/website/docs/reference/resource-properties/constraints.md +++ b/website/docs/reference/resource-properties/constraints.md @@ -101,7 +101,38 @@ Here are some examples showing how the new syntax is used: ```yml models: - +models: + - 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: ... ```