39 lines
984 B
PHP
39 lines
984 B
PHP
|
<?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();
|
||
|
}
|
||
|
};
|