I
I
ildar-meyker2020-01-22 19:44:21
Laravel
ildar-meyker, 2020-01-22 19:44:21

Empty selections after adding indexes on a pivot table. Why?

Added in migrations:
Schema::table('author_book', function (Blueprint $table) {
$table->foreign('book_id')->references('id')->on('books')->onDelete( 'cascade');
$table->foreign('author_id')->references('id')->on('authors')->onDelete('cascade');
});
From a curious, raw sql query (peeped in telescope) gets the data. But laravel itself began to return an empty result in all places where a pivot table is used. The point is in the indexes, since it was worth deleting them in SequelPro, so everything became normal again.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question