<?php

declare(strict_types=1);

namespace Migrations;

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

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20251006214859 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Change kampagne FK to RESTRICT (kampagne must exist)';
    }

    public function up(Schema $schema): void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE reloadsperre DROP FOREIGN KEY `FK_B6A62B2AACE19231`');
        $this->addSql('ALTER TABLE reloadsperre ADD CONSTRAINT FK_B6A62B2AACE19231 FOREIGN KEY (kampagne_id) REFERENCES kampagnen (id) ON DELETE RESTRICT');
        $this->addSql('ALTER TABLE users CHANGE rolle rolle ENUM(\'user\', \'admin\', \'werbenetzwerk\')');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE reloadsperre DROP FOREIGN KEY FK_B6A62B2AACE19231');
        $this->addSql('ALTER TABLE reloadsperre ADD CONSTRAINT `FK_B6A62B2AACE19231` FOREIGN KEY (kampagne_id) REFERENCES kampagnen (id) ON DELETE CASCADE');
        $this->addSql('ALTER TABLE users CHANGE rolle rolle ENUM(\'user\', \'admin\', \'werbenetzwerk\') DEFAULT NULL');
    }
}
