<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddMaxDaysToExamEventTeachers extends Migration
{
    public function up()
    {
        if ($this->db->fieldExists('max_days', 'exam_event_teachers')) return;
        $fields = [
            'max_days' => [
                'type'       => 'INT',
                'constraint' => 11,
                'default'    => 0, // 0 means unlimited
                'null'       => false,
                'after'      => 'role',
            ],
        ];
        $this->forge->addColumn('exam_event_teachers', $fields);
    }

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