<?php

declare(strict_types=1);

namespace Plugin\tnt_international_phone\Migrations;

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

class Migration20260722000000 extends Migration implements IMigration
{
    public function up()
    {
        $this->execute("CREATE TABLE IF NOT EXISTS `tnt_ip_invalid_phone` (
                `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
                `form` VARCHAR(64) NOT NULL DEFAULT '',
                `field` VARCHAR(32) NOT NULL DEFAULT '',
                `raw_value` VARCHAR(255) NOT NULL DEFAULT '',
                `country_hint` VARCHAR(8) NULL,
                `reason` VARCHAR(64) NOT NULL DEFAULT '',
                `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
                PRIMARY KEY (`id`),
                KEY `idx_created_at` (`created_at`)
            ) ENGINE=InnoDB COLLATE utf8mb4_unicode_ci");
    }

    public function down()
    {
        $this->execute('DROP TABLE IF EXISTS `tnt_ip_invalid_phone`');
    }
}
