Files

63 lines
3.5 KiB
Markdown
Raw Permalink Normal View History

# 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` | 否 | 文档创建时间,由数据库自动生成 |
## 索引
| 索引名 | 类型 | 说明 |
| :--- | :--- | :--- |
| `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`
- `document_create` 已作为原生 PocketBase 列表排序字段,推荐使用 `sort=-document_create`
- 面向用户填写的字段里,仅 `document_title``document_type` 必填,其余允许为空。
- PocketBase 系统字段 `created``updated` 仍然存在,只是不在 collection 字段清单里单独声明。