<?php

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

class AddPenyataColumnsToVoterTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('voter', function (Blueprint $table) {
            $table->enum('persetujuan', ['Bersetuju', 'Tidak Bersetuju'])->nullable()->after('kehadiran');
            $table->enum('status_penyata', ['DRAF', 'DISAHKAN', 'PERLU_SEMAK'])->default('DRAF')->after('persetujuan');
            $table->dateTime('tarikh_sah')->nullable()->after('status_penyata');
            $table->json('cadangan')->nullable()->after('tarikh_sah');
        });
    }

    public function down()
    {
        Schema::table('voter', function (Blueprint $table) {
            $table->dropColumn([
                'persetujuan',
                'status_penyata',
                'tarikh_sah',
                'cadangan'
            ]);
        });
    }
}
