BinaryField failing unique constraint SQLite
维护者通常 4 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 SQLite 方言的 BinaryField 处理开始,并使用报告中所示的 Example 模型重现该问题。验证带有 unique=True 的 BinaryField 能被接受,schema 包含 BLOB NOT NULL UNIQUE,并且插入重复字节会引发唯一性错误。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
When trying to implement a UNIQUE constraint on a BinaryField, the program raised a ConfigurationError indicating that the field could not be indexed. SQLite does support UNIQUE constraints on a Binary or BLOB field.
To Reproduce
class Example(models.Model):
id = fields.UUIDField(pk=True)
binary = fields.BinaryField(unique=True, null=False)
When adding this model, you'll get tortoise.exceptions.ConfigurationError: BinaryField can't be indexed.
CREATE TABLE Example(
id CHAR(36) NOT NULL PRIMARY KEY,
binary BLOB NOT NULL UNIQUE
);
This will work perfectly on SQLite. .schema Example returns the correct schema and inserting data will work and raise an error when duplicate bytes are inserted.
Expected behavior
I would like to see the removal of indexable = False on SQLite Binary fields, as it is supported by the dialect.
- 主要语言
- Python
- 星标
- 5.6k
- 派生
- 543
- 平均合并
- 4 天 7 小时
- 30 天内合并 PR
- 31
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tortoise/tortoise-orm 的其他 Issue
-
Automatic DatetimeField values bypass custom validators可能已有人在做 @IlyaKhalafi 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 83/100
tortoise/tortoise-orm#2409 ·
维护者通常 4 天内回复
-
UUIDField skips configured validators when writing values可能已有人在做 @IlyaKhalafi 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 25/100
tortoise/tortoise-orm#2407 ·
维护者通常 4 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
tortoise/tortoise-orm#2406 ·
维护者通常 4 天内回复
-
TimeField skips validators for timedelta values可能已有人在做 @IlyaKhalafi 于 2 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 35/100
tortoise/tortoise-orm#2404 ·
维护者通常 4 天内回复
-
Email domain allowlists reject equivalent mixed-case domains可能已有人在做 @IlyaKhalafi 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 35/100
tortoise/tortoise-orm#2402 ·
维护者通常 4 天内回复
查看 tortoise/tortoise-orm 的全部 Issue
相似的 Issue
-
integration: logger
难度 2/5 1-3 小时 新手友好度 68/100
home-assistant/core#191147 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
documentation p4
难度 1/5 1-3 小时 新手友好度 88/100
MillenniumDawn/focus-tree-creation-tool#417 ·
维护者通常 3 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
CharlesP44/Beem_Energy#96 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
rheeloaded/paperpull#153 ·
维护者通常 1 天内回复