46 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
| <?php
 | |
| 
 | |
| 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('Evaluasi', function (Blueprint $table) {
 | |
|             $table->id('EvaluasiId');
 | |
|             $table->unsignedInteger('PelaporanId');
 | |
|             $table->string('DokumenEval', 255)->nullable();
 | |
|             $table->unsignedInteger('TipeDokumen')->default(0)->comment('0 = Surat Evaluasi SKL, 1 = SE Status Mutu, 2 = SE Lainnya');
 | |
|             $table->string('Email', 255)->nullable();
 | |
|             $table->dateTime('TanggalKirim')->nullable();
 | |
|             $table->integer('Oleh')->nullable();
 | |
| 
 | |
|             $table->index('PelaporanId', 'IndexEvaluasi_PelaporanId');
 | |
| 
 | |
|             // Menambahkan foreign key untuk relasi dengan tabel Pelaporan
 | |
|             $table->foreign('PelaporanId')
 | |
|                   ->references('PelaporanId')
 | |
|                   ->on('Pelaporan')
 | |
|                   ->onDelete('cascade');
 | |
|                   $table->timestamps();
 | |
|         });
 | |
| 
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Reverse the migrations.
 | |
|      */
 | |
|     public function down(): void
 | |
|     {
 | |
|         Schema::table('Evaluasi', function (Blueprint $table) {
 | |
|             $table->dropForeign(['PelaporanId']);
 | |
|         });
 | |
|         Schema::dropIfExists('Evaluasi');
 | |
|     }
 | |
| };
 |