presensi/database/migrations/2024_02_06_create_cuti_tabl...

32 lines
1.1 KiB
Plaintext

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCutiTable extends Migration
{
public function up()
{
Schema::create('cuti', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users')->onDelete('cascade');
$table->string('jenis_cuti');
$table->date('tanggal_mulai');
$table->date('tanggal_selesai');
$table->text('keterangan');
$table->enum('status', ['Pending', 'Disetujui', 'Ditolak'])->default('Pending');
$table->string('file_pdf')->nullable();
$table->foreignId('approved_by')->nullable()->constrained('users');
$table->timestamp('approved_at')->nullable();
$table->foreignId('rejected_by')->nullable()->constrained('users');
$table->timestamp('rejected_at')->nullable();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('cuti');
}
}