it never happened
This commit is contained in:
parent
8805a01919
commit
4cc4cf9e78
1 changed files with 0 additions and 51 deletions
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue