it never happened

This commit is contained in:
Olivier Legat 2021-04-20 09:57:23 +02:00
parent 8805a01919
commit 4cc4cf9e78

View file

@ -1,51 +0,0 @@
<?php
use App\Models\Product;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RemoveSofdeleteFromProductsTable extends Migration
{
/**
* Run the migrations.
* ajout une cascade vers foodProduct
* lance un delete des produits sofdelete puis
* supprime la colonne de softdelete
*
* @return void
*/
public function up()
{
Schema::table('food_products', function (Blueprint $table) {
$table->dropForeign('food_products_product_id_foreign');
$table->foreign('product_id')
->references('id')->on('products')
->onDelete('cascade');
});
Product::onlyTrashed()->forceDelete();
Schema::table('products', function (Blueprint $table) {
$table->dropSoftDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('food_products', function (Blueprint $table) {
$table->dropForeign('food_products_product_id_foreign');
$table->foreign('product_id')
->references('id')->on('products');
});
Schema::table('products', function (Blueprint $table) {
$table->softDeletes();
});
}
}