播种 Table,自动增量字段为零

Seeding Table with auto increment field as zero

我为 table 创建了播种机,我尝试插入的第一条记录的 ID=0。 ID 是一个自动递增字段,当它被插入时,我检查它的 ID,它是 1 而不是 0,所以当我尝试创建 ID 为 1 的记录时,播种机在下一行中断。

如何插入多条记录,第一条记录的 ID 为 0?

这是我的代码:

DB::table('payment_status')->delete();
DB::table('payment_status')->insert(array('id' => '0', 'name' => 'Initial'));
DB::table('payment_status')->insert(array('id' => '1', 'name' => 'Payment successful, Waiting for Processing'));

多亏了 Uueerdo 的建议,我才能够完成这项工作,在插入后更新该行:

DB::table('payment_status')->delete();
DB::table('payment_status')->insert(array('id' => '0', 'name' => 'Initial'));
// id zero does not work
DB::unprepared("UPDATE payment_status SET id=0");
DB::table('payment_status')->insert(array('id' => '1', 'name' => 'Payment successful, Waiting for Processing'));