<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class PenilaianAbsensi extends Migration
{
    public function up()
    {
        $this->forge->addField([
            'id' => [
                'type' => 'INT',
                'constraint' => 11,
                'unsigned' => true,
                'auto_increment' => true,
            ],
            'id_siswa' => [
                'type' => 'INT',
                'constraint' => 11,
            ],
            'sakit' => [
                'type' => 'INT',
                'constraint' => 2,
            ],
            'ijin' => [
                'type' => 'INT',
                'constraint' => 2,
            ],
            'alfa' => [
                'type' => 'INT',
                'constraint' => 2,
            ],
            'catatan' => [
                'type' => 'VARCHAR',
                'constraint' => 255,
            ],
            'tahunpelajaran' => [
                'type' => 'VARCHAR',
                'constraint' => 255,
            ],
            'status' => [
                'type'       => 'ENUM',
                'constraint' => ['aktif', 'tidak'],
                'default'    => 'aktif',
            ],
            'created_at' => [
                'type' => 'TIMESTAMP',
            ],

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

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