Biginteger auto_increment主键Phinx

Jaz*_*Cat 3 cakephp auto-increment phinx

我正在尝试使用biginteger-primary密钥创建迁移并将其切换为auto_increment.

我正在使用robmorgans Phinx来创建迁移.

是否可以在创建数据类型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();
Run Code Online (Sandbox Code Playgroud)

ndm*_*ndm 7

没有auto_increment选择,请参阅

http://docs.phinx.org/en/latest/migrations.html#valid-column-options

您正在寻找的是identity选项,它将引用

启用或禁用自动递增

http://docs.phinx.org/en/latest/migrations.html?highlight=identity#valid-column-options

->changeColumn('id', 'biginteger', ['identity' => true])
Run Code Online (Sandbox Code Playgroud)