<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddGolonganToTeachers extends Migration
{
    public function up()
    {
        if ($this->db->fieldExists('golongan', 'teachers')) return;
        $this->forge->addColumn('teachers', [
            'golongan' => [
                'type'       => 'VARCHAR',
                'constraint' => 20,
                'null'       => true,
                'default'    => null,
                'comment'    => 'Pangkat/Golongan, contoh: Penata Muda/III-a, Pembina/IV-a',
                'after'      => 'nip',
            ],
        ]);
    }

    public function down()
    {
        $this->forge->dropColumn('teachers', 'golongan');
    }
}