<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class ChangeNilaiAkhirToDecimal extends Migration
{
    public function up()
    {
        // Ubah nilai_akhir dari TINYINT ke DECIMAL(5,2)
        // agar bisa menyimpan nilai desimal seperti 87.45, 92.50
        $this->db->query("
            ALTER TABLE assessment_scores
            MODIFY COLUMN nilai_akhir DECIMAL(5,2) UNSIGNED NULL
        ");
    }

    public function down()
    {
        // Kembalikan ke TINYINT (nilai desimal akan dipotong)
        $this->db->query("
            ALTER TABLE assessment_scores
            MODIFY COLUMN nilai_akhir TINYINT UNSIGNED NULL
        ");
    }
}
