# `ai_sql_error_history`

> 动态生成SQL错误历史


- **Engine:** InnoDB
- **Collation:** utf8mb4_0900_ai_ci

## Columns

| # | Name | Type | Null | Key | Default | Extra | Comment |
|---|---|---|---|---|---|---|---|
| 1 | `iIncrement` | `bigint` | NO | PRI |  | auto_increment | 主键ID |
| 2 | `sId` | `varchar(255)` | NO | UNI |  |  | 唯一id |
| 3 | `iOrder` | `int` | NO |  | 0 |  | 排序号 |
| 4 | `tCreateDate` | `datetime` | NO |  | CURRENT_TIMESTAMP | DEFAULT_GENERATED | 创建时间 |
| 5 | `sBrandsId` | `varchar(255)` | NO |  |  |  | 公司 |
| 6 | `sSubsidiaryId` | `varchar(255)` | NO |  |  |  | 子公司 |
| 7 | `sMakePerson` | `varchar(255)` | NO |  |  |  | 创建人 |
| 8 | `sBillNo` | `varchar(255)` | NO |  |  |  | 单号 |
| 9 | `sFormId` | `varchar(64)` | NO |  | 20260315043100959962495618726445 |  | 窗体ID |
| 10 | `sStatus` | `tinyint` | NO |  | 1 |  | 状态：1=启用，0=禁用 |
| 11 | `sSceneId` | `varchar(50)` | NO | MUL |  |  | 业务场景ID |
| 12 | `sMethodId` | `varchar(50)` | NO | MUL |  |  | 操作方法Id |
| 13 | `sQuestion` | `longtext` | NO |  |  |  | 用户问题 |
| 14 | `sError_sql` | `longtext` | YES |  |  |  | 错误的SQL |
| 15 | `sError_mes` | `longtext` | YES |  |  |  | 错误的原因 |
| 16 | `sCorrect_sql` | `longtext` | YES |  |  |  | 正确的SQL |
| 17 | `bCheck` | `bit(1)` | NO |  | b'0' |  | 是否审核 |
| 18 | `bInvalid` | `bit(1)` | NO |  | b'0' |  | 是否作废 |
| 19 | `sLoginId` | `varchar(255)` | NO |  |  |  | 用户ID |
| 20 | `sPrompt` | `longtext` | YES |  |  |  | 系统提示词 |

## Indexes

| Name | Unique | Type | Columns |
|---|---|---|---|
| `IndexN_1` |  | BTREE | `sSceneId` |
| `IndexN_2` |  | BTREE | `sMethodId` |
| `IndexN_sId` | ✓ | BTREE | `sId` |
| `PRIMARY` | ✓ | BTREE | `iIncrement` |
| `uk_scene_method` |  | BTREE | `sMethodId`, `sSceneId` |

## Narrative

_No human-written narrative yet — when this table is exercised by a [vertical slice](../../slices/index.md), link from there back to this page._
