This commit is contained in:
2025-12-02 13:36:09 +08:00
parent ee6dd64f98
commit 94718edd6b
97 changed files with 570 additions and 579 deletions

View File

@@ -180,7 +180,7 @@ ORDER BY create_time;
### 配置类型
- `config_type`: String / Integer / Boolean / Float / Double
- `config_type`: String / INTEGER / BOOLEAN / Float / Double
- `render_type`: select / input / textarea / checkbox / radio / switch
### 常用查询
@@ -481,14 +481,14 @@ GROUP BY a.agent_id, a.agent_name;
| `dept_path` | VARCHAR(255) | 部门全路径(多租户隔离) |
| `creator` | VARCHAR(50) | 创建者ID |
| `updater` | VARCHAR(50) | 更新者ID |
| `create_time` | timestamptz | 创建时间(带时区) |
| `update_time` | timestamptz | 更新时间(触发器自动更新) |
| `delete_time` | timestamptz | 删除时间 |
| `create_time` | TIMESTAMPTZ | 创建时间(带时区) |
| `update_time` | TIMESTAMPTZ | 更新时间(触发器自动更新) |
| `delete_time` | TIMESTAMPTZ | 删除时间 |
| `deleted` | BOOLEAN | 软删除标记 |
### 时间戳说明
- 使用 `timestamptz` 类型(带时区的时间戳)
- 使用 `TIMESTAMPTZ` 类型(带时区的时间戳)
- 自动记录创建时间
- 更新时间由触发器自动维护
- 支持软删除(保留 delete_time

View File

@@ -183,7 +183,7 @@ agent ← 智能体管理和平台基础设施
### 1. 数据类型使用
- **timestamptz**:全部时间字段(带时区支持)
- **TIMESTAMPTZ**:全部时间字段(带时区支持)
- **JSONB**:配置、元数据、扩展字段
- **数组TEXT[]**标签、关键词、ID列表
- **DECIMAL**:金额、评分(精确计算)

View File

@@ -59,7 +59,7 @@ tb_sys_user:
- 支持多种登录方式(emailphonewechat_id
- 密码加密存储(建议bcrypt/argon2
- 软删除机制(deleted + delete_time
- 时区感知时间戳(timestamptz
- 时区感知时间戳(TIMESTAMPTZ
```
### 3.2 知识库管理模块 (knowledge)
@@ -419,8 +419,8 @@ CREATE TABLE sys.tb_sys_user_dept (
is_primary BOOLEAN DEFAULT false, -- 是否主部门
position VARCHAR(100), -- 职位
creator VARCHAR(50) DEFAULT NULL,
create_time timestamptz NOT NULL DEFAULT now(),
update_time timestamptz DEFAULT NULL,
create_time TIMESTAMPTZ NOT NULL DEFAULT now(),
update_time TIMESTAMPTZ DEFAULT NULL,
deleted BOOLEAN NOT NULL DEFAULT false,
PRIMARY KEY (user_id, dept_id),
UNIQUE (optsn)
@@ -475,7 +475,7 @@ CREATE TABLE file.tb_file_relation (
relation_type VARCHAR(30) DEFAULT 'attachment', -- 关联类型attachment-附件/avatar-头像/banner-横幅
order_num INTEGER DEFAULT 0,
creator VARCHAR(50) DEFAULT NULL,
create_time timestamptz NOT NULL DEFAULT now(),
create_time TIMESTAMPTZ NOT NULL DEFAULT now(),
deleted BOOLEAN NOT NULL DEFAULT false,
PRIMARY KEY (relation_id),
UNIQUE (optsn),
@@ -504,8 +504,8 @@ CREATE TABLE message.tb_message_template (
dept_path VARCHAR(255) DEFAULT NULL,
creator VARCHAR(50) DEFAULT NULL,
updater VARCHAR(50) DEFAULT NULL,
create_time timestamptz NOT NULL DEFAULT now(),
update_time timestamptz DEFAULT NULL,
create_time TIMESTAMPTZ NOT NULL DEFAULT now(),
update_time TIMESTAMPTZ DEFAULT NULL,
deleted BOOLEAN NOT NULL DEFAULT false,
PRIMARY KEY (template_id),
UNIQUE (optsn),
@@ -688,7 +688,7 @@ pg_restore -d urbanlifeline -c backup_20240101.dump
- **Schema数**9 个业务Schema
- **索引类型**B-Tree、GIN、部分索引、表达式索引
- **数据类型**:标准类型 + JSONB + 数组 + 向量(可选)
- **时区支持**:全部使用timestamptz
- **时区支持**:全部使用TIMESTAMPTZ
- **软删除**全表支持deleted标记
---