<?php

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

return new class extends Migration
{
    public function up()
    {
        Schema::table('rap', function (Blueprint $table) {
            $table->dropColumn([
                'komisi_per_mahasiswa',
                'komisi_semester_1',
                'komisi_semester_2',
                'komisi_semester_3',
                'total_komisi_cair',
                'komisi_semester_1_cair',
                'komisi_semester_2_cair',
                'komisi_semester_3_cair',
                'tanggal_cair_semester_1',
                'tanggal_cair_semester_2',
                'tanggal_cair_semester_3',
            ]);
        });
    }

    public function down()
    {
        Schema::table('rap', function (Blueprint $table) {
            $table->integer('komisi_per_mahasiswa')->nullable()->after('status');
            $table->integer('komisi_semester_1')->nullable()->after('komisi_per_mahasiswa');
            $table->integer('komisi_semester_2')->nullable()->after('komisi_semester_1');
            $table->integer('komisi_semester_3')->nullable()->after('komisi_semester_2');
            $table->integer('total_komisi_cair')->nullable()->after('komisi_semester_3');
            $table->boolean('komisi_semester_1_cair')->default(false)->after('total_komisi_cair');
            $table->boolean('komisi_semester_2_cair')->default(false)->after('komisi_semester_1_cair');
            $table->boolean('komisi_semester_3_cair')->default(false)->after('komisi_semester_2_cair');
            $table->timestamp('tanggal_cair_semester_1')->nullable()->after('komisi_semester_3_cair');
            $table->timestamp('tanggal_cair_semester_2')->nullable()->after('tanggal_cair_semester_1');
            $table->timestamp('tanggal_cair_semester_3')->nullable()->after('tanggal_cair_semester_2');
        });
    }
};
