<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddExitColumnsToStudentsTable extends Migration
{
    public function up()
    {
        $fields = [
            'exit_date'   => ['type' => 'DATE',    'null' => true,                    'after' => 'status'],
            'exit_to'     => ['type' => 'VARCHAR',  'constraint' => 150, 'null' => true, 'after' => 'exit_date'],
            'exit_reason' => ['type' => 'TEXT',    'null' => true,                    'after' => 'exit_to'],
        ];

        $this->forge->addColumn('students', $fields);
    }

    public function down()
    {
        $this->forge->dropColumn('students', ['exit_date', 'exit_to', 'exit_reason']);
    }
}