如下,需要注意的是identity字段,而不是auto_increment。
$table = $this->table('test', ['id' => false, 'primary_key' => 'id']);
$table->addColumn('id', 'biginteger', ['null' => false, 'signed' => false, 'identity' => true])
->addColumn('title', 'string', ['limit' => 50, 'null' => false])
->addColumn('created_at', 'datetime', ['null' => false])
->create();
Was this helpful?
1 / 0