<?php

namespace App\Database\Migrations\Elearning;

use CodeIgniter\Database\Migration;

class TahunPelajaran extends Migration
{
    public function up()
    {
        $fields = [
            'id' => ['type' => 'int', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
            'kode' => ['type' => 'varchar', 'constraint' => 128, 'unique' => true],
            'nama' => ['type' => 'varchar', 'constraint' => 255,],
            'semester' => ['type' => 'enum', 'constraint' => "'Ganjil','Genap'"],
            'is_active' => ['type' => 'enum', 'constraint' => "'1','0'", 'default' => '0'],
            'created_at datetime default current_timestamp',
            'updated_at datetime default current_timestamp',
        ];
        $this->forge->addField($fields);
        $this->forge->addKey('id', true);
        $this->forge->createTable('tahun_pelajaran', true);
    }

    public function down()
    {
        $this->forge->dropTable('tahun_pelajaran', true);
    }
}
