0
我用CreateNewsTable migratin創建了新聞表。在CreateNewsTable遷移代碼是:laravel migration生成的外鍵約束的名稱是什麼
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNewsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('news', function (Blueprint $table) {
$table->string('author');
$table->string('title');
$table->string('title_image_path');
$table->string('summary');
$table->text('body');
$table->bigInteger('timestamp');
$table->boolean('published');
$table->primary(['author', 'title', 'timestamp']);
$table->foreign('author')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('news');
}
}
現在我想刪除外鍵約束,但我不知道外鍵約束的名字。 請提前幫助我,感謝您的回答。
Yottatron,謝謝你快速和有用的answer.my問題解決。 – loghman
非常好,很高興聽到,很高興我可以幫助。 –