# 数据库架构

## 核心表

### sta_files

存储所有传输文件的记录。

| 列 | 类型 | 描述 |
|----|------|------|
| `id` | UUID | 主键 |
| `file_name` | string | 文件名 |
| `system` | string | BCB 系统 |
| `direction` | string | 方向 (inbound/outbound) |
| `status` | string | 处理状态 |
| `content` | text | 文件内容 |
| `metadata` | jsonb | 附加元数据 |
| `error_message` | text | 错误信息 |
| `retry_count` | integer | 重试次数 |
| `inserted_at` | timestamp | 创建时间 |
| `updated_at` | timestamp | 更新时间 |

### sta_routes

存储路由配置。

| 列 | 类型 | 描述 |
|----|------|------|
| `id` | UUID | 主键 |
| `name` | string | 路由名称 |
| `system` | string | 目标系统 |
| `destination_url` | string | 目标地址 |
| `parser` | string | 解析器类型 |
| `enabled` | boolean | 是否启用 |

### sta_metrics

存储系统指标数据。

| 列 | 类型 | 描述 |
|----|------|------|
| `id` | UUID | 主键 |
| `metric_type` | string | 指标类型 |
| `value` | float | 指标值 |
| `recorded_at` | timestamp | 记录时间 |
