dropForeign(['user_id']); $table->foreign('app_user_id') ->references('id')->on('app_users') ->onDelete('cascade'); }); Schema::table('directorables', function (Blueprint $table) { $table->dropForeign(['directory_id']); $table->foreign('directory_id') ->references('id')->on('directories') ->onDelete('cascade'); }); Schema::table('directories', function (Blueprint $table) { $table->dropForeign('directories_parent_foreign'); $table->foreign('directory_id') ->references('id') ->on('directories') ->onDelete('cascade'); }); Schema::table('documents', function (Blueprint $table) { $table->dropForeign('documents_directory_foreign'); $table->foreign('directory_id') ->references('id') ->on('directories') ->onDelete('cascade'); $table->dropForeign('documents_document_id_foreign'); $table->foreign('document_id') ->references('id') ->on('documents') ->onDelete('cascade'); $table->dropColumn('parent'); }); Schema::table('taggables', function (Blueprint $table) { $table->dropForeign(['tag_id']); $table->foreign('tag_id') ->references('id')->on('tags') ->onDelete('cascade'); $table->dropForeign(['taggable_id']); $table->foreign('taggable_id') ->references('id')->on('documents') ->onDelete('cascade'); }); } /** * Reverse the migrations. * * @return void */ public function down(): void { Schema::table('contacts', function (Blueprint $table) { $table->dropForeign(['app_user_id']); $table->foreign('app_user_id') ->references('id')->on('app_users'); }); Schema::table('directorables', function (Blueprint $table) { $table->dropForeign(['directory_id']); $table->foreign('directory_id') ->references('id')->on('directories'); }); Schema::table('directories', function (Blueprint $table) { $table->dropForeign(['directory_id']); $table->foreign('directory_id') ->references('id') ->on('directories'); }); Schema::table('documents', function (Blueprint $table) { $table->dropForeign(['directory_id']); $table->foreign('directory_id') ->references('id') ->on('directories'); $table->dropForeign(['document_id']); $table->foreign('document_id') ->references('id') ->on('documents'); }); Schema::table('taggables', function (Blueprint $table) { $table->dropForeign(['tag_id']); $table->foreign('tag_id') ->references('id')->on('tags'); }); } };