feat: 添加微信认证相关的 OpenAPI 规范,包括用户信息、登录请求和个人资料请求 feat: 添加 is_delete 字段迁移脚本,支持在集合中添加软删除字段 feat: 添加软删除规则应用脚本,确保所有相关集合的查询规则包含软删除条件 feat: 添加购物车和订单业务 ID 自动生成的迁移脚本,确保字段类型和自动生成规则正确
3.8 KiB
3.8 KiB
pb_tbl_document
来源:线上 PocketBase collection 回读、
script/pocketbase.documents.js类型:base读写规则:公开可读;新增 / 修改 / 删除仅ManagePlatform/ 管理角色允许
表用途
用于存储文档主体信息,以及图片、视频、文件三类附件的关联关系。
字段清单
| 字段名 | 类型 | 必填 | 说明 |
|---|---|---|---|
id |
text |
是 | PocketBase 记录主键 |
document_id |
text |
是 | 文档业务 ID |
document_effect_date |
date |
否 | 文档生效日期 |
document_expiry_date |
date |
否 | 文档到期日期 |
document_type |
text |
是 | 文档类型,多选时按 `system_dict_id@dict_word_enum |
document_title |
text |
是 | 文档标题 |
document_subtitle |
text |
否 | 文档副标题 |
document_summary |
text |
否 | 文档摘要 |
document_content |
text |
否 | 正文内容,保存 Markdown |
document_image |
text |
否 | 图片附件 ID 集合,底层以 ` |
document_video |
text |
否 | 视频附件 ID 集合,底层以 ` |
document_owner |
text |
否 | 上传者 openid |
document_relation_model |
text |
否 | 关联机型 / 模型标识 |
document_keywords |
text |
否 | 关键词,多选后以 ` |
document_share_count |
number |
否 | 分享次数 |
document_download_count |
number |
否 | 下载次数 |
document_favorite_count |
number |
否 | 收藏次数 |
document_status |
text |
否 | 文档状态,仅 有效 / 过期 |
document_embedding_status |
text |
否 | 文档嵌入状态 |
document_embedding_error |
text |
否 | 文档嵌入错误原因 |
document_embedding_lasttime |
date |
否 | 最后一次嵌入更新时间 |
document_vector_version |
text |
否 | 向量版本号 / 模型名称 |
document_product_categories |
text |
否 | 产品关联文档,多选后以 ` |
document_application_scenarios |
text |
否 | 筛选依据,多选后以 ` |
document_hotel_type |
text |
否 | 适用场景,多选后以 ` |
document_remark |
text |
否 | 备注 |
document_file |
text |
否 | 普通文件附件 ID 集合,底层以 ` |
document_create |
autodate |
否 | 文档创建时间,由数据库自动生成 |
is_delete |
number |
否 | 软删除标记,0 表示未删除,1 表示已删除,默认 0 |
索引
| 索引名 | 类型 | 说明 |
|---|---|---|
idx_tbl_document_document_id |
UNIQUE INDEX |
保证 document_id 唯一 |
idx_tbl_document_document_create |
INDEX |
加速按创建时间倒序查询 |
idx_tbl_document_document_owner |
INDEX |
加速按上传者查询 |
idx_tbl_document_document_type |
INDEX |
加速按文档类型查询 |
idx_tbl_document_document_status |
INDEX |
加速按文档状态查询 |
idx_tbl_document_document_embedding_status |
INDEX |
加速按嵌入状态查询 |
idx_tbl_document_document_effect_date |
INDEX |
加速按生效日期查询 |
idx_tbl_document_document_expiry_date |
INDEX |
加速按到期日期查询 |
补充约定
- 三类附件字段都只保存
attachments_id,真实文件统一在tbl_attachments。 is_delete用于软删除控制,文档删除时建议优先标记为1,避免直接物理删除。- 集合默认查询规则已内置
is_delete = 0,公开列表与详情默认隐藏已软删除文档。 document_create已作为原生 PocketBase 列表排序字段,推荐使用sort=-document_create。- 面向用户填写的字段里,仅
document_title、document_type必填,其余允许为空。 - PocketBase 系统字段
created、updated仍然存在,只是不在 collection 字段清单里单独声明。