I have a pivot table named 'author_book' & i'm using sqlite
This is the create method of the table
Schema::create('author_book', function (Blueprint $table) {
$table->integer('author_id')->index();
$table->integer('book_id')->index();
$table->timestamps();
$table->foreign('author_id')
->references('id')
->on('authors');
$table->foreign('book_id')
->references('id')
->on('books');
});
Now i want to add onDelete('cascade') for those foreign keys. I'm following the solution of Ferid Movsumov - http://stackoverflow.com/questions/26820788/add-on-delete-cascade-to-existing-column-in-laravel
Created another migration & added this
Schema::table('author_book', function (Blueprint $table) {
$table->dropForeign('author_id');
$table->foreign('author_id')
->references('id')
->on('authors')
->onDelete('cascade');
$table->dropForeign('book_id');
$table->foreign('book_id')
->references('id')
->on('books')
->onDelete('cascade');
});
But nothing has changed, the schema definition of 'author_book' table remains same. What am i doing wrong?