2 回答

TA貢獻(xiàn)1770條經(jīng)驗 獲得超3個贊
我所做的就是轉(zhuǎn)到config文件夾然后database.php將 mysql 數(shù)據(jù)庫引擎從 null 更改為 innoDB 即來自:
//...
'engine' => null,
//...
到:
//...
'engine' => 'InnoDB',
//...

TA貢獻(xiàn)1848條經(jīng)驗 獲得超10個贊
您用于Schema::create創(chuàng)建表。
在 Laravel 文檔中,我Schema::table在使用外鍵時看到。也許你應(yīng)該嘗試拆分你的代碼:
Schema::create('articles', function (Blueprint $table) {
$table->id('id');
$table->unsignedBigInteger('user_id');
$table->string('title');
$table->text('excerpt');
$table->text('body');
$table->timestamps();
});
Schema::table('articles', function (Blueprint $table) {
$table->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
});
- 2 回答
- 0 關(guān)注
- 136 瀏覽
添加回答
舉報