<?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 Version20250919165140 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 author_game (gamemaster_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', game_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_C7C4B95396376157 (gamemaster_id), INDEX IDX_C7C4B953E48FD905 (game_id), PRIMARY KEY(gamemaster_id, game_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('ALTER TABLE author_game ADD CONSTRAINT FK_C7C4B95396376157 FOREIGN KEY (gamemaster_id) REFERENCES gamemaster (id) ON DELETE CASCADE');
        $this->addSql('ALTER TABLE author_game ADD CONSTRAINT FK_C7C4B953E48FD905 FOREIGN KEY (game_id) REFERENCES game (id) ON DELETE CASCADE');
        $this->addSql('ALTER TABLE gamemaster ADD is_author TINYINT(1) DEFAULT NULL');
    }

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