admin/sql/README.md
zzh 983dff12c5
All checks were successful
Build and Deploy / deploy (push) Successful in 1m2s
feat: 店铺订单落库物流商与履约类型,并规范迁移脚本日期命名
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-16 18:01:46 +08:00

20 lines
1.2 KiB
Markdown
Raw Permalink 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_<主题>_YYYYMMDD.sql`(日期放在文件名**末尾**,如 `migrate_sales_store_order_provider_fulfillment_20261016.sql`)
- 尽量可重复执行(先判断列/表/字典是否已存在)
- **后续新增脚本一律带日期后缀**;历史未带日期的脚本不强制改名