Skip to content

Commit

Permalink
doc/md/atlas-schema: add clickhouse hcl syntax for primary key expres…
Browse files Browse the repository at this point in the history
…sions
  • Loading branch information
datdao committed Jun 19, 2024
1 parent 60535ba commit ee7495c
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion doc/md/atlas-schema/hcl.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,9 @@ primary key.

#### Example

<Tabs>
<TabItem label="Columns" value="columns">

```hcl
primary_key {
columns = [column.id]
Expand All @@ -632,7 +635,36 @@ primary_key {

| Name | Kind | Type | Description |
|---------|-----------|--------------------------|----------------------------------------------------------------|
| columns | resource | reference (list) | A list of references to columns that comprise the primary key. |
| columns | attribute | reference (list) | A list of references to columns that comprise the primary key. |

</TabItem>
<TabItem label="Expressions" value="expr">

:::info
Note, primary key expressions are supported by ClickHouse.
:::

```hcl
primary_key {
on {
column = column.id
}
on {
expr = "c1 + c2"
}
}
```

#### Properties

| Name | Kind | Type | Description |
|---------|-----------|--------------------------|----------------------------------------------------------------|
| on | resource | schema.IndexPart (list) | The index parts that comprise the index |

</TabItem>
</Tabs>



## Foreign Key

Expand Down

0 comments on commit ee7495c

Please sign in to comment.