<?php

declare(strict_types=1);

namespace app\migrations;

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

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20260405171429 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('ALTER TABLE mod_modpack DROP CONSTRAINT fk_9449c4f4949d6aeb');
        $this->addSql('ALTER TABLE mod_modpack DROP CONSTRAINT fk_9449c4f4338e21cd');
        $this->addSql('DROP TABLE mod_modpack');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('CREATE TABLE mod_modpack (mod_id INT NOT NULL, modpack_id INT NOT NULL, PRIMARY KEY (mod_id, modpack_id))');
        $this->addSql('CREATE INDEX idx_9449c4f4338e21cd ON mod_modpack (mod_id)');
        $this->addSql('CREATE INDEX idx_9449c4f4949d6aeb ON mod_modpack (modpack_id)');
        $this->addSql('ALTER TABLE mod_modpack ADD CONSTRAINT fk_9449c4f4949d6aeb FOREIGN KEY (modpack_id) REFERENCES modpack (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('ALTER TABLE mod_modpack ADD CONSTRAINT fk_9449c4f4338e21cd FOREIGN KEY (mod_id) REFERENCES mod (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
    }
}
