Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

inserting null on an autoincrement primary key prevents cleanup

オープン
#58 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
php

調査の方向性

まず、自動インクリメント主キーを使用して haveInDatabase(table, ['id' => null, ...]) のケースを再現し、その後、teardown cleanup のために挿入された ID がどのように記録されるかを追跡します。生成された主キーの値が保持され、cleanup 中に挿入された行が削除され、かつ autoincrement 列が主キーではないケースを壊さないことを確認できれば完了です。

索引モデルが 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 はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Codeception/module-db のほかの issue

Codeception/module-db の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。