<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateLeavesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('leaves', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('uid')->default(0);
            $table->unsignedInteger('emp_id');
            $table->tinyInteger('state')->default(0);
            $table->time('leave_time')->default('16:05:10');
            $table->date('leave_date')->default('2025-02-06');
            $table->tinyInteger('status')->default(1);
            $table->unsignedTinyInteger('type')->default(1);
            $table->timestamps();

            // Tambahkan index untuk emp_id
            $table->index('emp_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('leaves');
    }
} 