<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;

class CreateConsoleData extends Migration
{
    public function up()
    {
        $this->db->simpleQuery("CREATE TABLE `console_data` (
            `id` INT NOT NULL AUTO_INCREMENT,
            `context` VARCHAR(50) NULL,
            `data` LONGTEXT NULL,
            `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP(),
            PRIMARY KEY (`id`),
            INDEX (`context`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
    }

    public function down()
    {
        $this->forge->dropTable('console_data');
    }
}
