<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class Matapelajaran extends Migration
{
    public function up()
    {
        $this->forge->addField([
            'id' => [
                'type' => 'INT',
                'constraint' => 11,
                'unsigned' => true,
                'auto_increment' => true,
            ],
            'nama_matapelajaran' => [
                'type' => 'VARCHAR',
                'constraint' => 255,
            ],
            'kelompok' => [
                'type' => 'VARCHAR',
                'constraint' => 255,
            ],
            'jurusan' => [
                'type' => 'VARCHAR',
                'constraint' => 255,
            ],
            'no_urut' => [
                'type' => 'INT',
                'constraint' => 2,
            ],
            'status' => [
                'type'       => 'ENUM',
                'constraint' => ['aktif', 'tidak'],
                'default'    => 'aktif',
            ],
            'created_at' => [
                'type' => 'TIMESTAMP',
                'null' => true,
            ],

        ]);
        $this->forge->addKey('id', true);
        $this->forge->createTable('matapelajaran');
    }

    public function down()
    {
        $this->forge->dropTable('matapelajaran');
    }
}
