<?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 Version20250220024749 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('CREATE TABLE navigation (id INT AUTO_INCREMENT NOT NULL, page_id INT DEFAULT NULL, parent_id INT DEFAULT NULL, priority INT NOT NULL, url VARCHAR(180) DEFAULT NULL, title VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, target_blank TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_493AC53FF47645AE (url), INDEX IDX_493AC53FC4663E4 (page_id), INDEX IDX_493AC53F727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('ALTER TABLE navigation ADD CONSTRAINT FK_493AC53FC4663E4 FOREIGN KEY (page_id) REFERENCES page (id)');
        $this->addSql('ALTER TABLE navigation ADD CONSTRAINT FK_493AC53F727ACA70 FOREIGN KEY (parent_id) REFERENCES navigation (id) ON DELETE SET NULL');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE navigation DROP FOREIGN KEY FK_493AC53FC4663E4');
        $this->addSql('ALTER TABLE navigation DROP FOREIGN KEY FK_493AC53F727ACA70');
        $this->addSql('DROP TABLE navigation');
    }
}
