Skip to content

feat: 新增跨方言 JSON 类型 JSONType(rebase 版,替代 #543 的冲突) - #545

Merged
fastapiadmin merged 1 commit into
devfrom
fix/json-type-rebased
Oct 22, 2026
Merged

fastapiadmin merged 1 commit into
devfrom
fix/json-type-rebased

Conversation

@fastapiadmin

Copy link
Copy Markdown
Owner

原 PR #543 的内容,基于最新 dev 重新应用(保留原作者 Echo-Note)。

为什么需要 rebase:#543 与 #541 都修改了 backend/app/core/base_model.py 第 1 行的 from sqlalchemy import ...,
#541 先合并(45a8ade9)后 #543 变为 CONFLICTING。本 PR 把 JSON 加入 import 列表并新增
from sqlalchemy.dialects.postgresql import JSONB + JSONType 常量,内容与 #543 完全一致。

验证(本地实跑)

  • DDL:PostgreSQL → JSONB;SQLite / MySQL → JSON
  • SQLite create_all 建表 + JSON 写入读回:{'a': [1, 2, {'b': 3}]}
  • ruff All checks passed / basedpyright 0 errors / pytest 97 passed

关联 #542(本 PR 只提供统一入口,生成器路径的修复见 issue 上的后续说明)。

原 PR #543 的实现,因其与 #541 同改 base_model.py 的 import 行产生冲突,此处为基于最新
dev 的 rebase 版本,改动内容与原提交一致(提交作者保留为 Echo-Note)。

- PostgreSQL:JSONB;SQLite / MySQL:通用 JSON(TypeEngine.with_variant)
- 验证:三方言 DDL(JSONB / JSON / JSON)、sqlite create_all 建表 + JSON 读写、
  ruff / basedpyright 0 errors / pytest 97 passed

关联 issue #542:本 PR 提供统一入口;生成器 jsonb 映射与方言类型 import 的修复留作后续。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants