admin/sql/README.md
zzh 8258ae746e
All checks were successful
Build and Deploy / deploy (push) Successful in 1m7s
feat: 客户更新接口支持局部字段,并补充开发/SQL 规范说明
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-15 19:53:24 +08:00

18 lines
997 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# sql/
OMS / 共用库的建表脚本已统一到仓库根目录 `db.sql`。
## 职责边界
本目录**只放 DDL / 存量迁移 / 字典种子**等库结构与一次性数据脚本。
- **运行时业务查询与写入必须走 SqlSugar ORM(仓储)**,不要在 Application 里用手写 SQL 替代 CRUD。
- 完整编码标准见仓库根目录 `README.md` →「开发规范」。
## 使用说明
- 新环境:直接执行 `db.sql`(会 DROP 后重建,勿在有生产数据的库上执行)
- 已有库:用 diff 对比 `db.sql` 与现库结构后手工 ALTER;本目录 `migrate_all.sql` 为存量增量迁移合集(可重复执行段已做列/表存在判断;揽收 Direction / FeePush 为裸 ALTER,已执行过请跳过)
- 数据权限表(`user_org_perm` 等)若 RBAC 与 OMS 分库,请只在 RBAC 库执行 `db.sql` 末尾对应段落
- 单次增量迁移命名:`migrate_<主题>.sql`,尽量可重复执行(先判断列/表/字典是否已存在)