<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20250603185820 extends AbstractMigration
{

    public function getDescription(): string
    {
        return '';
    }

    public function up(Schema $schema): void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->addSql(<<<'SQL'
            CREATE TABLE webauthn_credential (id VARCHAR(255) NOT NULL, public_key_credential_id LONGTEXT NOT NULL, type VARCHAR(255) NOT NULL, transports JSON NOT NULL COMMENT '(DC2Type:json)', attestation_type VARCHAR(255) NOT NULL, trust_path JSON NOT NULL COMMENT '(DC2Type:trust_path)', aaguid TINYTEXT NOT NULL, credential_public_key LONGTEXT NOT NULL, user_handle VARCHAR(255) NOT NULL, counter INT NOT NULL, other_ui JSON DEFAULT NULL COMMENT '(DC2Type:json)', backup_eligible TINYINT(1) DEFAULT NULL, backup_status TINYINT(1) DEFAULT NULL, uv_initialized TINYINT(1) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
        SQL
        );
        $this->addSql(<<<'SQL'
            ALTER TABLE administrator_user ADD uuid BINARY(16) NOT NULL COMMENT '(DC2Type:uuid)'
        SQL
        );
        $this->addSql(<<<'SQL'
            CREATE UNIQUE INDEX UNIQ_419BAA4D17F50A6 ON administrator_user (uuid)
        SQL
        );
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql(<<<'SQL'
            DROP TABLE webauthn_credential
        SQL
        );
        $this->addSql(<<<'SQL'
            DROP INDEX UNIQ_419BAA4D17F50A6 ON administrator_user
        SQL
        );
        $this->addSql(<<<'SQL'
            ALTER TABLE administrator_user DROP uuid
        SQL
        );
    }

}
