22 lines
1.3 KiB
Python
22 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
||||
|
|
# B3 便宜版(档案 19 §C5):给废弃/不可达的表加注释(**不得含反引号**——schema 是 TS 模板字符串)
|
|||
|
|
import io
|
|||
|
|
p = '/opt/dshs/src/db/schema.ts'
|
|||
|
|
s = io.open(p, encoding='utf-8').read()
|
|||
|
|
|
|||
|
|
W = """-- 【2026-09-11 档案 19 §C5 便宜版】该表在本部署已废弃:folder_plugins 无任何业务/路由调用
|
|||
|
|
-- (grep 实证:仅 src/db/* 自引用;档案 16 已宣布 folder 级插件废弃)。
|
|||
|
|
-- 保留表结构仅为兼容 k8s/PG 未验证路径(档案 19 §C8)——请勿在此表上新增功能。
|
|||
|
|
CREATE TABLE IF NOT EXISTS folder_plugins ("""
|
|||
|
|
assert s.count('CREATE TABLE IF NOT EXISTS folder_plugins (') == 2
|
|||
|
|
s = s.replace('CREATE TABLE IF NOT EXISTS folder_plugins (', W)
|
|||
|
|
|
|||
|
|
WS = """-- 【2026-09-11 档案 19 §C5 便宜版】该表仅被 enablePatch 分支使用
|
|||
|
|
-- (src/web/routes/dsh.ts 的 findWorkspaceByPath),而 DEFAULT_ENABLE_PATCH=false 且生产 env 未覆盖
|
|||
|
|
-- → 本部署不可达。保留以兼容 k8s 路径;请勿在此表上新增功能。
|
|||
|
|
CREATE TABLE IF NOT EXISTS workspaces ("""
|
|||
|
|
assert s.count('CREATE TABLE IF NOT EXISTS workspaces (') == 2
|
|||
|
|
s = s.replace('CREATE TABLE IF NOT EXISTS workspaces (', WS)
|
|||
|
|
assert '`' not in W and '`' not in WS
|
|||
|
|
io.open(p, 'w', encoding='utf-8', newline='').write(s)
|
|||
|
|
print('schema.ts 已加 4 处注释(无引号版)')
|