Skip to content

Commit a2475ef

Browse files
authored
doc: add AvailableSince component (#545)
1 parent 6a82197 commit a2475ef

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Admonition from '@theme/Admonition';
2+
import { FC } from 'react';
3+
4+
interface AvailableSinceProps {
5+
version: string;
6+
}
7+
8+
const AvailableSince: FC<AvailableSinceProps> = ({ version }) => {
9+
return <Admonition type="note" title={`Available since ${version}`}></Admonition>;
10+
};
11+
12+
export default AvailableSince;

docs/modeling/model.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ sidebar_position: 3
33
description: Models in ZModel
44
---
55

6+
import AvailableSince from '../_components/AvailableSince';
7+
68
# Model
79

810
The `model` construct is the core of ZModel. It defines the structure of your data and relations. A model represents a domain entity and is backed by a database table.
@@ -164,6 +166,10 @@ model User {
164166
}
165167
```
166168

169+
### Custom ID formats
170+
171+
<AvailableSince version="v3.1.0" />
172+
167173
Prefixing and suffixing entity IDs is becoming more common in database design, usually by including the model name in the generated ID. To support this pattern, functions that generate `String` IDs (`cuid()`, `uuid()`, `ulid()`, `nanoid()`) takes an optional `format` argument to allow passing in a pattern that controls the output format. `%s` in the pattern will be replaced by the generated id. For example:
168174

169175
```zmodel

0 commit comments

Comments
 (0)