1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Added bookshelf view, update, delete

- Enabled proper ordering of Books in a shelf.
- Improved related item destroy for all entities.
This commit is contained in:
Dan Brown
2018-09-16 19:34:09 +01:00
parent f455b317ec
commit 47b08888ba
14 changed files with 239 additions and 342 deletions

View File

@ -33,6 +33,7 @@ class CreateBookshelvesTable extends Migration
Schema::create('bookshelves_books', function (Blueprint $table) {
$table->integer('bookshelf_id')->unsigned();
$table->integer('book_id')->unsigned();
$table->integer('order')->unsigned();
$table->foreign('bookshelf_id')->references('id')->on('bookshelves')
->onUpdate('cascade')->onDelete('cascade');
@ -86,7 +87,15 @@ class CreateBookshelvesTable extends Migration
DB::table('role_permissions')->whereIn('id', $permissionIds)->delete();
// Drop shelves table
Schema::dropIfExists('bookshelves');
Schema::dropIfExists('bookshelves_books');
Schema::dropIfExists('bookshelves');
// Drop related polymorphic items
DB::table('activities')->where('entity_type', '=', 'BookStack\Bookshelf')->delete();
DB::table('views')->where('viewable_type', '=', 'BookStack\Bookshelf')->delete();
DB::table('entity_permissions')->where('restrictable_type', '=', 'BookStack\Bookshelf')->delete();
DB::table('tags')->where('entity_type', '=', 'BookStack\Bookshelf')->delete();
DB::table('search_terms')->where('entity_type', '=', 'BookStack\Bookshelf')->delete();
DB::table('comments')->where('entity_type', '=', 'BookStack\Bookshelf')->delete();
}
}