<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddChapterDplKbcToLearningDevices extends Migration
{
    public function up()
    {
        if ($this->db->fieldExists('chapter_dpl', 'learning_devices')) return;
        $this->forge->addColumn('learning_devices', [
            'chapter_dpl' => [
                'type' => 'TEXT',
                'null' => true,
                'after' => 'panca_cinta',
            ],
            'chapter_kbc' => [
                'type' => 'TEXT',
                'null' => true,
                'after' => 'chapter_dpl',
            ],
        ]);
    }

    public function down()
    {
        $this->forge->dropColumn('learning_devices', 'chapter_dpl');
        $this->forge->dropColumn('learning_devices', 'chapter_kbc');
    }
}
