You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
559 B
Markdown
35 lines
559 B
Markdown
# 种子数据
|
|
|
|
框架不写业务 seed。
|
|
业务项目和 `iti-system` 各自维护自己的 seed。
|
|
|
|
## 规则
|
|
|
|
- 幂等。
|
|
- 按唯一键 upsert。
|
|
- 不删除用户数据。
|
|
- 不替代 migration。
|
|
- 可重复执行。
|
|
|
|
## iTi-System
|
|
|
|
系统包提供:
|
|
|
|
```bash
|
|
uv run iti-system seed system app:app
|
|
```
|
|
|
|
它会写入默认角色、管理员、系统菜单、字典和配置。
|
|
|
|
## 业务项目
|
|
|
|
业务项目可以写普通 Python 函数:
|
|
|
|
```python
|
|
def seed_example(db):
|
|
...
|
|
```
|
|
|
|
也可以暴露 click 命令。
|
|
框架不要求固定 seed DSL。
|