inserting null on an autoincrement primary key prevents cleanup
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 38/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- php
- 领域
- databases, testing-qa
调研方向
首先使用自增主键复现 haveInDatabase(table, ['id' => null, ...]) 的情况,然后跟踪插入的 ID 是如何为 teardown cleanup 记录的。完成的标准是保留生成的主键值,并在 cleanup 期间删除插入的行,同时不破坏自增列不是主键的情况。
由索引模型根据 Issue 内容生成。
描述
When I have a table with a primary key column that's also increment, it's valid to set it to null on the insert statement. the last insert it will then return the auto increment value, which is the primary key in that case.
As already noticed in #44, the auto increment column doesn't have to be part of the primary key, so the return value of last insert id ironically doesn't necessarily belong to the primary key. However, #44 also broke the case, which one might perceive as more common, that the last insert id may also be the primary key.
So, haveInDatabase(table, ['id' => null, ...]) with id as autoincrement and pk will lead to the id being set to null for cleanup, which results in the row not being removed at teardown.
I have prepared a fix for this case, which hopefully is specific enough to not interfere with other use cases.
- 主要语言
- PHP
- 星标
- 23
- 派生
- 31
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Codeception/module-db 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 42/100
Codeception/module-db#87 ·
-
难度 4/5 3-5 天 新手友好度 25/100
Codeception/module-db#85 ·
-
Make optional the auto-erase of the records, added by `haveInDatabase()`可能已有人在做 @iliayatsenko 于 723 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
Codeception/module-db#68 · 1 条评论 ·
-
Fix a confusion between 'cleanup' and 'skip_cleanup_if_failed' configuration params可能已有人在做 @iliayatsenko 于 723 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
Codeception/module-db#67 ·
-
难度 3/5 1-2 天 新手友好度 45/100
Codeception/module-db#54 ·
查看 Codeception/module-db 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
documentation good first issue help wanted up-for-grabs
难度 2/5 1-3 小时 新手友好度 83/100
AnikethTS/RunnerDeck#307 ·
维护者通常 1 天内回复
-
sync-en
难度 1/5 1 小时以内 新手友好度 78/100
维护者通常 1 天内回复
-
sync-en
难度 1/5 1 小时以内 新手友好度 86/100
维护者通常 1 天内回复
-
Перевод устарел
难度 1/5 1 小时以内 新手友好度 65/100
维护者通常 1 天内回复