<?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 Version20231007221519 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 season_data DROP FOREIGN KEY FK_2BBA6FFD3346729B');
        $this->addSql('DROP INDEX IDX_2BBA6FFD3346729B ON season_data');
        $this->addSql('ALTER TABLE season_data DROP captain_id');
        $this->addSql('ALTER TABLE team ADD captain_id INT DEFAULT NULL');
        $this->addSql('ALTER TABLE team ADD CONSTRAINT FK_CAPTAIN_ID FOREIGN KEY (captain_id) REFERENCES user (id)');
        $this->addSql('CREATE UNIQUE INDEX UNIQ_CAPTAIN_ID ON team (captain_id)');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE season_data ADD captain_id INT DEFAULT NULL');
        $this->addSql('ALTER TABLE season_data ADD CONSTRAINT FK_2BBA6FFD3346729B FOREIGN KEY (captain_id) REFERENCES user (id)');
        $this->addSql('CREATE INDEX IDX_2BBA6FFD3346729B ON season_data (captain_id)');
        $this->addSql('ALTER TABLE team DROP FOREIGN KEY FK_C4E0A61F3346729B');
        $this->addSql('DROP INDEX UNIQ_C4E0A61F3346729B ON team');
        $this->addSql('ALTER TABLE team DROP captain_id');
    }
}
