54 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.6 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('Verifikasi', function (Blueprint $table) {
 | |
|             $table->id('VerifikasiId');
 | |
|             $table->unsignedInteger('PelaporanId');
 | |
|             $table->unsignedInteger('RefPelaporanId');
 | |
|             $table->tinyInteger('Verif');
 | |
|             $table->dateTime('Tanggal');
 | |
|             $table->integer('Oleh');
 | |
| 
 | |
|             // Membuat index
 | |
|             $table->index('PelaporanId', 'Index_PelaporanId');
 | |
|             $table->index('RefPelaporanId', 'Index_RefPelaporanId');
 | |
| 
 | |
|             // Menambahkan foreign key untuk relasi dengan tabel Pelaporan
 | |
|             $table->foreign('PelaporanId')
 | |
|                   ->references('PelaporanId')
 | |
|                   ->on('Pelaporan')
 | |
|                   ->onDelete('cascade');
 | |
| 
 | |
|             // Menambahkan foreign key untuk relasi dengan tabel RefPelaporan
 | |
|             $table->foreign('RefPelaporanId')
 | |
|                   ->references('RefPelaporanId')
 | |
|                   ->on('RefPelaporan')
 | |
|                   ->onDelete('cascade');
 | |
| 
 | |
|             $table->timestamps();
 | |
|         });
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Reverse the migrations.
 | |
|      */
 | |
|     public function down(): void
 | |
|     {
 | |
|         Schema::table('Verifikasi', function (Blueprint $table) {
 | |
|             $table->dropForeign(['PelaporanId']);
 | |
|             $table->dropForeign(['RefPelaporanId']);
 | |
|         });
 | |
|         Schema::dropIfExists('Verifikasi');
 | |
|     }
 | |
| };
 |