39 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.1 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('Post', function (Blueprint $table) {
 | |
|             $table->id('PostId');
 | |
|             $table->unsignedBigInteger('KategoriId');
 | |
|             $table->unsignedBigInteger('SubKategoriId');
 | |
|             $table->string('JudulPost');
 | |
|             $table->string('SlugPost');
 | |
|             $table->text('DescPost');
 | |
|             $table->string('ImagePost')->nullable();
 | |
|             $table->boolean('IsPublish')->default(1);
 | |
|             $table->timestamps();
 | |
| 
 | |
| 
 | |
|             $table->foreign('KategoriId')->references('KategoriId')->on('Kategori')->onDelete('cascade');
 | |
|             $table->foreign('SubKategoriId')->references('SubKategoriId')->on('SubKategori')->onDelete('cascade');
 | |
|         });
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Reverse the migrations.
 | |
|      */
 | |
|     public function down(): void
 | |
|     {
 | |
|         Schema::dropIfExists('Post');
 | |
|     }
 | |
| };
 |