初始版本
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# 初始数据模块
|
||||
|
||||
此目录用于存放数据库初始化时的示例数据脚本。
|
||||
|
||||
## 使用说明
|
||||
|
||||
在数据库初始化后,可以运行此模块中的脚本来插入示例数据,方便开发和测试。
|
||||
|
||||
## 示例
|
||||
|
||||
```python
|
||||
from app.db.session import SessionLocal
|
||||
from app.models.user import User
|
||||
from app.core.security import get_password_hash
|
||||
|
||||
def init_data():
|
||||
db = SessionLocal()
|
||||
# 创建示例用户等
|
||||
...
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user