<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddEventCodeToExamEvents extends Migration
{
    public function up()
    {
        if ($this->db->fieldExists('event_code', 'exam_events')) return;
        $fields = [
            'event_code' => [
                'type'       => 'VARCHAR',
                'constraint' => 20,
                'null'       => true,
            ],
        ];
        $this->forge->addColumn('exam_events', $fields);
    }

    public function down()
    {
        $this->forge->dropColumn('exam_events', 'event_code');
    }
}
