40 lines
		
	
	
		
			1015 B
		
	
	
	
		
			PHP
		
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1015 B
		
	
	
	
		
			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('Komunal', function (Blueprint $table) {
 | |
|             $table->id('KomunalId');
 | |
|             $table->unsignedInteger('PelaporanId');
 | |
|             $table->enum('Tersambung', ['Iya', 'Tidak']);
 | |
| 
 | |
|             $table->index('PelaporanId', 'IndexKomunal_PelaporanId');
 | |
| 
 | |
|             $table->foreign('PelaporanId')
 | |
|                   ->references('PelaporanId')
 | |
|                   ->on('Pelaporan')
 | |
|                   ->onDelete('cascade');
 | |
|             $table->timestamps();
 | |
|         });
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Reverse the migrations.
 | |
|      */
 | |
|     public function down(): void
 | |
|     {
 | |
|         Schema::table('Komunal', function (Blueprint $table) {
 | |
|             $table->dropForeign(['PelaporanId']);
 | |
|         });
 | |
|         Schema::dropIfExists('Komunal');
 | |
|     }
 | |
| };
 |