@lark-apaas/coding-openclaw-sandbox-skills 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -37,6 +37,25 @@ npm run gen:db-schema
|
|
|
37
37
|
- 后续依赖 schema 的代码生成、类型检查全部失败
|
|
38
38
|
- 用户看到的错误信息难以定位根因
|
|
39
39
|
|
|
40
|
+
## ⚠️ schema.ts 不包含全部约束,查结构要用 db schema
|
|
41
|
+
|
|
42
|
+
`gen:db-schema` 生成的 `schema.ts` 是数据库的**有损镜像**:下面两类约束会被丢掉,且不留任何提示。
|
|
43
|
+
|
|
44
|
+
| 库里的定义 | `schema.ts` 里的结果 |
|
|
45
|
+
|---|---|
|
|
46
|
+
| 条件索引 `CREATE UNIQUE INDEX ... (a, b) WHERE status = 'active'` | `uniqueIndex("...").on(table.a, table.b)` —— **WHERE 条件消失** |
|
|
47
|
+
| CHECK 约束 `CHECK (char_length(b) > 0)` | **完全不出现** |
|
|
48
|
+
| 表达式索引 `CREATE INDEX ... (lower(b))` | 保留为 `// Complex index: <原始 DDL>` 注释 |
|
|
49
|
+
|
|
50
|
+
危害集中在第一类:丢掉 WHERE 之后,`schema.ts` 读起来是「(a, b) 全表唯一」,而库里只对 `status = 'active'` 的行唯一。按 `schema.ts` 理解唯一性范围去写 Service 层的重复校验、或判断「这个列缺索引」,结论都会是错的。
|
|
51
|
+
|
|
52
|
+
**判断表结构、索引、约束的真实形状,一律用 `db schema <表名>`** —— 它输出的是库里的 DDL 原文,WHERE 和 CHECK 都在。`schema.ts` 只用于 TS 代码的类型对齐。
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# 确认约束真实形状(含 partial index 的 WHERE、CHECK 约束)
|
|
56
|
+
npx -y @lark-apaas/miaoda-data-cli db schema <table_name>
|
|
57
|
+
```
|
|
58
|
+
|
|
40
59
|
---
|
|
41
60
|
|
|
42
61
|
## 通用约定
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/coding-openclaw-sandbox-skills",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "OpenClaw 独立沙箱 skills 包(原 miaoda-skills/src/openclaw + miaoda-skills/src/miaoda/steering/miaoda-openclaw 合并);变更频率低,独立发版",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|