I am writing migrations script in cakephp 3 using Phinx. I need to add a column with primary key while updating the table(using update() command) using migrations. But when I run the script, it created the column but does not include the primary key.
$table->addColumn('book_id', 'integer', [
'default' => null,
'limit' => 11,
'null' => true
])->addPrimaryKey('book_id');
$table->update();
Thanks
Per the Docs:
Dealing with primary key can only be done on table creation operations. This is due to limitations for some database servers the plugin supports.