✨ feat(sqlite): 支持表结构编辑器配置自增主键 - #8949
Conversation
- 新增 SQLite 整数类型主键的 AUTOINCREMENT 选项,并限制单表仅一个自增主键 - 解析 SQLite `AUTOINCREMENT` 列属性并保留扩展属性 - 生成 SQLite 建表语句时,将 `PRIMARY KEY AUTOINCREMENT` 内联至列定义 - 避免非自增整数主键自动附加 AUTOINCREMENT
- apply_auto_inc_to_column_def only emits the AUTOINCREMENT suffix when the source column explicitly requests auto-increment (the implicit integer-PK heuristic keeps applying to other suffixes), so schema sync and rebuild no longer upgrade plain or composite integer primary keys to sqlite_sequence semantics or emit invalid DDL - recognize the native autoincrement spelling when reading back metadata, and normalize integer-family aliases to exact INTEGER in both the create-table and sync paths since SQLite accepts AUTOINCREMENT only on INTEGER PRIMARY KEY - reject composite or non-integer auto-increment primary keys with a clear warning, and surface an explicit rebuild warning when toggling AUTOINCREMENT on an existing column instead of silently no-oping
|
感谢贡献!整体方向正确(内联
新增 6 个回归测试(别名归一、复合/非整数拒绝、普通整型 PK 同步不升级、复合 PK 同步合法、显式自增保留且 BIGINT 归一), |
t8y2
left a comment
There was a problem hiding this comment.
Direction verified against DBeaver's SQLite editor behavior (inline PRIMARY KEY AUTOINCREMENT, suppressed table-level PK), and the follow-up patch closed the alias-type DDL, the unconditional sync-path AUTOINCREMENT suffix, and the silent no-op on existing tables, with six regression tests and real-sqlite3 validation. All checks green; merging. The existing-table rebuild half of #8937 stays open for follow-up.
|
Thanks for the contribution! Merged in 3767f4a, will be released in the next version. |
变更说明
为 SQLite 表结构编辑器增加自增主键配置能力。
现在可以在字段扩展属性中为整型主键启用“自增”,并在重新打开已有表时恢复
AUTOINCREMENT状态。生成 SQLite DDL 时使用合法的内联语法:同时支持
INTEGER、INT、TINYINT、SMALLINT、MEDIUMINT和BIGINT等 SQLite 整型别名。变更类型
涉及前端
验证
已手动验证:
INTEGER主键字段并启用“自增”。1、2。关联 Issue
Close #8937