<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddFieldsToPengajuan extends Migration
{
    public function up()
    {
        $fields = [
            'periode' => [
                'type'       => 'VARCHAR',
                'constraint' => '20',
                'null'       => true,
                'after'      => 'user_id'
            ],
            'tahun' => [
                'type'       => 'YEAR',
                'null'       => true,
                'after'      => 'periode'
            ],
            'jenis_prosedur' => [
                'type'       => 'VARCHAR',
                'constraint' => '100',
                'null'       => true,
                'after'      => 'tahun'
            ],
        ];
        $this->forge->addColumn('pengajuan', $fields);
    }

    public function down()
    {
        $this->forge->dropColumn('pengajuan', ['periode', 'tahun', 'jenis_prosedur']);
    }
}
