<?php

declare(strict_types=1);

namespace Plugin\cin_ajax_search_5\Migrations;

use JTL\Plugin\Migration;
use JTL\Update\IMigration;

final class Migration20220608100346 extends Migration implements IMigration
{
  public function up(): void
  {
    $this->execute('CREATE TABLE IF NOT EXISTS `xplugin_cin_ajax_search_5_log` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `action` varchar(100) NOT NULL,
  `meta` text NOT NULL,
  `status` enum("info","warn","error") NOT NULL,
  `created_at` timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4');
  }

  public function down(): void
  {
    if ($this->doDeleteData()) {
      $this->execute('DROP TABLE IF EXISTS `xplugin_cin_ajax_search_5_log`');
    }
  }
}
