<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddRulesToSchoolSettings extends Migration
{
    public function up()
    {
        if ($this->db->fieldExists('proctor_rules', 'school_settings')) return;
        $fields = [
            'proctor_rules' => [
                'type' => 'TEXT',
                'null' => true,
            ],
            'student_rules' => [
                'type' => 'TEXT',
                'null' => true,
            ],
        ];
        $this->forge->addColumn('school_settings', $fields);
    }

    public function down()
    {
        $this->forge->dropColumn('school_settings', 'proctor_rules');
        $this->forge->dropColumn('school_settings', 'student_rules');
    }
}
