Skip to content

Commit

Permalink
doc: add exclusion constraint to hcl (#2732)
Browse files Browse the repository at this point in the history
  • Loading branch information
a8m authored Apr 30, 2024
1 parent 87cf226 commit 296a12c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions doc/md/atlas-schema/hcl.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,39 @@ concurrently first and then converted to a unique constraint. To achieve this, f
4. Replace the `index` block with a `unique` block to create a new unique constraint using the existing index.
:::

### Exclude Constraints

The `exclude` block allows defining a [exclusion constraint](https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-EXCLUSION)
supported by PostgreSQL:

```hcl
exclude "excl_speaker_during" {
type = GIST
on {
column = column.speaker
op = "="
}
on {
column = column.during
op = "&&"
}
}
# Include non-key columns.
exclude "excl_speaker_during" {
type = GIST
on {
column = column.speaker
op = "="
}
on {
column = column.during
op = "&&"
}
include = [column.another]
}
```

## Trigger

:::info LOGIN REQUIRED
Expand Down

0 comments on commit 296a12c

Please sign in to comment.