Hi @bobbybouwmann - it also only created one foreign key for the user_id - rather than 2. Yes I'm using Sequel Pro.
Dec 16, 2015
4
Level 3
Migration multiple foreign keys
I'm just realised that even though I've set two foreign keys in my migration only the second one gets actually added.
Here's my schema:
Schema::create('favorites', function (Blueprint $table) {
$table->integer('lecture_id')->unsigned();
$table->integer('user_id')->unsigned();
$table->timestamps();
$table->primary(['lecture_id', 'user_id']);
$table->foreign('lecture_id')
->references('id')->on('lectures')
->onDelete('cascade');
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
});
I get both primary keys and only watched_user_id_foreign for the foreign constraint. Any idea why?
Level 88
It's working fine for me!
I get the following results


1 like
Please or to participate in this conversation.