feat(db): H001 改名 S001,新增 S002(空库存版)
S001: 含完整入库/出库/库存历史数据 S002: 基础数据相同(商品/供应商/仓库),入库/出库/库存均为空,模拟新门店 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -54,7 +54,7 @@ jiu/
|
||||
│ ├── testutil/setup.go # 测试工具包(SQLite DB、CreateTestXxx、GetAuthToken)
|
||||
│ ├── cmd/seed/main.go # 数据库工具(--reset 删表重建,--clear 清空数据)
|
||||
│ ├── seeds/
|
||||
│ │ └── H001.sql # 门店 H001 测试种子数据(SQL 命令形式)
|
||||
│ │ └── S001.sql # 门店 S001 测试种子数据(SQL 命令形式)
|
||||
│ └── schema/schema.sql # 完整建表 SQL(MySQL)
|
||||
├── client/ # Flutter 跨端客户端
|
||||
├── deploy/
|
||||
@@ -114,7 +114,7 @@ sh scripts/dev.sh --backend-only # 仅启动后端
|
||||
sh scripts/dev.sh --frontend-only # 仅启动前端
|
||||
|
||||
# 数据库
|
||||
sh scripts/dev.sh seed H001 # 清空并写入 H001 测试数据(执行 seeds/H001.sql)
|
||||
sh scripts/dev.sh seed S001 # 清空并写入 S001 测试数据(执行 seeds/S001.sql)
|
||||
sh scripts/dev.sh reset # 删表重建(AutoMigrate)
|
||||
sh scripts/dev.sh clear # 清空所有业务数据(保留表结构)
|
||||
```
|
||||
@@ -129,8 +129,8 @@ docker compose -f deploy/docker-compose.yml up -d
|
||||
sh scripts/dev.sh run
|
||||
|
||||
# 3. 写入测试数据(另开终端)
|
||||
sh scripts/dev.sh seed H001
|
||||
# 写入后可用以下账号登录(门店编号 H001):
|
||||
sh scripts/dev.sh seed S001
|
||||
# 写入后可用以下账号登录(门店编号 S001):
|
||||
# admin / password123 管理员
|
||||
# operator / password123 操作员
|
||||
# test / password123 只读
|
||||
@@ -222,4 +222,5 @@ client/lib/
|
||||
| 项目上下文 | docs/context/project.md | 本文件,所有 Agent 必读 |
|
||||
| 环境搭建 | docs/dev-setup.md | 工具安装 + 开发脚本详解 + 测试架构 |
|
||||
| Schema | backend/schema/schema.sql | 完整数据库建表 SQL |
|
||||
| H001 种子 | backend/seeds/H001.sql | 门店 H001 测试数据 |
|
||||
| S001 种子 | backend/seeds/S001.sql | 门店 S001 测试数据(含完整入库/出库/库存历史) |
|
||||
| S002 种子 | backend/seeds/S002.sql | 门店 S002 测试数据(基础数据相同,无库存/单据,模拟新门店) |
|
||||
|
||||
+5
-5
@@ -80,14 +80,14 @@ cd client && flutter pub get
|
||||
|
||||
| 命令 | 说明 |
|
||||
|------|------|
|
||||
| `sh scripts/dev.sh seed H001` | 清空并写入 H001 测试数据 |
|
||||
| `sh scripts/dev.sh seed S001` | 清空并写入 S001 测试数据 |
|
||||
| `sh scripts/dev.sh reset` | 删表重建(AutoMigrate) |
|
||||
| `sh scripts/dev.sh clear` | 清空所有业务数据(保留表结构) |
|
||||
|
||||
执行完成后会打印测试账号:
|
||||
|
||||
```
|
||||
门店编号: H001
|
||||
门店编号: S001
|
||||
admin / password123 (管理员,可审核单据)
|
||||
operator / password123 (操作员,可创建/提交单据)
|
||||
test / password123 (只读,仅查看)
|
||||
@@ -101,10 +101,10 @@ test / password123 (只读,仅查看)
|
||||
|
||||
### 新增门店测试数据
|
||||
|
||||
参照 `backend/seeds/H001.sql` 创建新文件 `backend/seeds/H002.sql`,然后执行:
|
||||
参照 `backend/seeds/S001.sql` 创建新文件 `backend/seeds/S002.sql`,然后执行:
|
||||
|
||||
```bash
|
||||
sh scripts/dev.sh seed H002
|
||||
sh scripts/dev.sh seed S002
|
||||
```
|
||||
|
||||
---
|
||||
@@ -121,7 +121,7 @@ sh scripts/dev.sh run
|
||||
# Flutter 窗口自动弹出
|
||||
|
||||
# 第三步(另开终端):写入测试数据
|
||||
sh scripts/dev.sh seed H001
|
||||
sh scripts/dev.sh seed S001
|
||||
|
||||
# 数据库管理界面(可选)
|
||||
# http://localhost:8888 服务器:mysql 用户:root 密码:password 库:jiu_db
|
||||
|
||||
Reference in New Issue
Block a user