clara/database/migrations/2023_04_17_135901_create_documents_table.php

51 lines
1.6 KiB
PHP

<?php
use App\Models\Directorat;
use App\Models\Job;
use App\Models\SpecialCode;
use App\Models\SubDirectorat;
use App\Models\SubJob;
use App\Models\SubSubJob;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('documents', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(Directorat::class)->constrained()->onDelete('cascade');
$table->foreignIdFor(SubDirectorat::class)->constrained()->onDelete('cascade');
$table->foreignIdFor(Job::class)->constrained()->onDelete('cascade');
$table->foreignIdFor(SubJob::class)->constrained()->onDelete('cascade');
$table->foreignIdFor(SubSubJob::class)->constrained()->onDelete('cascade');
$table->foreignIdFor(SpecialCode::class)->constrained()->onDelete('cascade');
$table->string('no_urut',3);
$table->string('kode', 15);
$table->string('status')->nullable();
$table->string('keterangan')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('created_by')->nullable();
$table->unsignedBigInteger('updated_by')->nullable();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('documents');
}
};