<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class Options extends Migration
{
    public function up()
    {
        $fields = [
            'option_id' => ['type' => 'int', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
            'option_name' => ['type' => 'varchar', 'constraint' => 255],
            'option_value' => ['type' => 'text', 'null' => true],
            'autoload' => ['type' => 'ENUM',  'constraint' => ['no', 'yes'], 'default' => 'no'],
        ];
        $this->forge->addField($fields);
        $this->forge->addKey('option_id', true);
        $this->forge->addUniqueKey('option_name');
        $this->forge->createTable('options', true);
    }

    public function down()
    {
        $this->forge->dropTable('options', true);
    }
}
