I am trying to create a migration with a biginteger-primary key and switch it to auto_increment.
I am using robmorgans Phinx to create the migration.
Is it possible to change a table's primary key of the datatype BIGINTEGER to be auto_incremented after you've created it?
Currently it looks like this.
$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();
There is no auto_increment
option, see
https://book.cakephp.org/phinx/0/en/migrations.html#valid-column-options
What you are looking for is the identity
option, which will, quote
enable or disable automatic incrementing
->changeColumn('id', 'biginteger', ['identity' => true])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With