<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('corporate_employees', function (Blueprint $table) {
            $table->id();
            $table->foreignId('corporate_id')->index();
            $table->foreignId('member_id')->index();
            $table->string('branch_code')->nullable()->index();
            $table->foreignId('division_id')->nullable()->index();
            $table->string('nik')->nullable()->index();
            $table->string('status')->nullable();

            $table->date('start')->nullable();
            $table->date('end')->nullable();
            
            $table->timestamps();
            $table->softDeletes();
            
            $table->foreignId('created_by')->nullable();
            $table->foreignId('updated_by')->nullable();
            $table->foreignId('deleted_by')->nullable();
        });
    }

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