skl/database/migrations/2025_03_12_094731_create_st...

47 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('Stb', function (Blueprint $table) {
$table->id('Stb_Id');
$table->unsignedInteger('PelaporanId');
$table->enum('EmisiStb', ['Iya', 'Tidak'])->default('Iya');
$table->integer('Cerobong')->nullable();
$table->string('SuratPernyataan', 255)->nullable();
$table->dateTime('TanggalUnggah')->nullable();
$table->tinyInteger('Verifikasi')->nullable();
$table->dateTime('TanggalVerifikasi')->nullable();
$table->string('Keterangan', 255)->nullable();
$table->unsignedInteger('Verifikator')->nullable();
$table->index('PelaporanId', 'IndexSTB_PelaporanId');
$table->foreign('PelaporanId')
->references('PelaporanId')
->on('Pelaporan')
->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('Stb', function (Blueprint $table) {
$table->dropForeign(['PelaporanId']);
});
Schema::dropIfExists('Stb');
}
};