2017-03-17 69 views
0

我正在使用Phinx在cakephp 3中編寫遷移腳本。 我需要在使用遷移更新表(使用update()命令)時添加包含主鍵的列。 但是,當我運行腳本時,它創建了列,但不包含主鍵。在更新cakephp上添加主鍵遷移的列cakephp

$table->addColumn('book_id', 'integer', [ 
    'default' => null, 
    'limit' => 11, 
    'null' => true 
    ])->addPrimaryKey('book_id'); 
    $table->update(); 

感謝

回答

0

the Docs

與主鍵的處理只能在創建表 操作來完成。這是由於一些數據庫服務器 插件支持的限制。