<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class Penilaian extends Migration
{
    public function up()
    {
        $this->forge->addField([
            'id' => [
                'type' => 'INT',
                'constraint' => 11,
                'unsigned' => true,
                'auto_increment' => true,
            ],
            'nis' => [
                'type' => 'VARCHAR',
                'constraint' => 200,
            ],
            'kode_mapel' => [
                'type' => 'VARCHAR',
                'constraint' => 250,
            ],
            'nilai' => [
                'type' => 'VARCHAR',
                'constraint' => 50,
            ],
            'semester' => [
                'type' => 'INT',
                'constraint' => 1,
                'default'    => 0,
            ],
            'tahunpelajaran' => [
                'type' => 'VARCHAR',
                'constraint' => 250,
            ],
            'created_at' => [
                'type' => 'TIMESTAMP',

            ],

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

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