<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddTypeToSchedules extends Migration
{
    public function up()
    {
        $fields = [
            'type' => [
                'type'       => 'VARCHAR',
                'constraint' => 20,
                'default'    => 'local',
                'after'      => 'notes',
            ],
            'custom_hours' => [
                'type'       => 'TEXT',
                'null'       => true,
                'after'      => 'type',
            ],
        ];
        $this->forge->addColumn('schedules', $fields);
    }

    public function down()
    {
        $this->forge->dropColumn('schedules', 'type');
        $this->forge->dropColumn('schedules', 'custom_hours');
    }
}
