Repository navigation
Conversation
docs(readme): 中英文 README 徽章区统一 + 修复未闭合的 </a>
fastapiadmin
added a commit
that referenced
this pull request
Oct 22, 2026
feat: 新增跨方言 JSON 类型 JSONType(rebase 版,替代 #543 的冲突)
Owner
|
感谢贡献 👍 这个改动本身已确认正确(三方言 DDL、SQLite 它与 #541 都修改了
因此本 PR 关闭,内容已进入 |
This was referenced Oct 22, 2026
xiaoyu-awk
pushed a commit
to xiaoyu-awk/FastapiAdmin
that referenced
this pull request
Oct 23, 2026
原 PR fastapiadmin#543 的实现,因其与 fastapiadmin#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 fastapiadmin#542:本 PR 提供统一入口;生成器 jsonb 映射与方言类型 import 的修复留作后续。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
MappedBase基类声明「兼容 SQLite、MySQL 和 PostgreSQL」,但业务模型若直接硬编码sqlalchemy.dialects.postgresql.JSONB,会在 SQLite / MySQL 下让create_all渲染失败:当前仓库已同时存在通用
JSON(如system/menu、task/storage)与JSONB两种用法,缺乏统一入口。改动
在
app/core/base_model.py新增统一的跨方言 JSON 类型:JSONB,保留索引 / 操作符能力。JSON,保证create_all与autogenerate三种方言零漂移。用法
业务模型定义 JSON 列时改用
JSONType,替代直接硬编码JSONB:验证
MappedBase.metadata.create_all均可正常编译、执行。JSONB迁移零漂移(with_variant在 PostgreSQL 方言下仍渲染为JSONB)。关联 issue:#542