<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddParentLinkCodeToStudentsTable extends Migration
{
    public function up()
    {
        $fields = [
            'parent_link_code' => [
                'type'       => 'VARCHAR',
                'constraint' => '16',
                'null'       => true,
                'unique'     => true,
                'after'      => 'class_id',
            ],
        ];

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

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