我正在尝试使用 biginteger-primary key 创建迁移并将其切换到 auto_increment .
我正在使用 罗伯摩根菲尼克斯 创建迁移。
创建表后,是否可以将数据类型为 BIGINTEGER 的表的主键更改为 auto_incremented?
目前它看起来像这样。
$positions = $this->table('positions', ['id' => false, 'primary_key' => 'id'])
->changeColumn('id', 'biginteger', ['auto_increment' => true])
->addColumn('work_order_id', 'char', ['after' => 'vehicle_id','default' => null, 'null' => true,'limit' => 36])
->update();
最佳答案
没有auto_increment
选项,见
https://book.cakephp.org/phinx/0/en/migrations.html#valid-column-options
您要找的是identity
选项,这将引用
enable or disable automatic incrementing
->changeColumn('id', 'biginteger', ['identity' => true])
关于cakephp - Biginteger auto_increment 主键 Phinx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34767268/