<?php

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

class AddApprovalFieldsToPermohonanTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('permohonan', function (Blueprint $table) {
            $table->boolean('approval_eo')->default(false)->after('status');
            $table->timestamp('approval_eo_at')->nullable()->after('approval_eo');

            $table->boolean('approval_dd')->default(false)->after('approval_eo_at');
            $table->timestamp('approval_dd_at')->nullable()->after('approval_dd');

            $table->boolean('approval_so')->default(false)->after('approval_dd_at');
            $table->timestamp('approval_so_at')->nullable()->after('approval_so');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('permohonan', function (Blueprint $table) {
            $table->dropColumn([
                'approval_eo', 'approval_eo_at',
                'approval_dd', 'approval_dd_at',
                'approval_so', 'approval_so_at'
            ]);
        });
    }
}
