<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class PemetaanKurikulumTable extends Migration
{
    public function up()
    {
        $this->forge->addField([
            'id' => [
                'type'           => 'INT',
                'constraint'     => 11,
                'unsigned'       => true,
                'auto_increment' => true,
            ],
            'prodi_id' => [
                'type'       => 'INT',
                'constraint' => 11,
                'unsigned'   => true,
            ],
            'angkatan' => [
                'type'       => 'VARCHAR',
                'constraint' => '4',
            ],
            'kurikulum_id' => [
                'type'       => 'INT',
                'constraint' => 11,
                'unsigned'   => true,
            ],
            'created_at' => [
                'type' => 'DATETIME',
                'null' => true,
            ],
            'updated_at' => [
                'type' => 'DATETIME',
                'null' => true,
            ],
        ]);
        $this->forge->addKey('id', true);
        
        // You could add foreign keys if your DB engine is InnoDB, but typical CI4 migrations might skip them or add them.
        // We will just create the table.
        $this->forge->createTable('pemetaan_kurikulum');
    }

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