Cetaklabel/Database/Migrations/2023_08_31_083425_update_cardboard_table.php

39 lines
984 B
PHP
Raw Normal View History

2023-08-31 08:41:46 +00:00
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Modules\Cetaklabel\Entities\Job;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::disableForeignKeyConstraints();
Schema::table('cardboards', function (Blueprint $table) {
$table->foreignIdFor(Job::class)->after('sub_directorat_id')->constrained()->onDelete('cascade');
});
Schema::enableForeignKeyConstraints();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::disableForeignKeyConstraints();
Schema::table('cardboards', function (Blueprint $table) {
$table->dropForeign(['job_id']);
$table->dropColumn('job_id');
});
Schema::enableForeignKeyConstraints();
}
};