<?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 Version20240208210630 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 notification (id INT AUTO_INCREMENT NOT NULL, requesting_user_id INT DEFAULT NULL, league_id INT DEFAULT NULL, type VARCHAR(255) DEFAULT NULL, message VARCHAR(280) DEFAULT NULL, is_accepted TINYINT(1) DEFAULT NULL, created_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', team_id INT DEFAULT NULL, INDEX IDX_BF5476CA2A841BBC (requesting_user_id), INDEX IDX_BF5476CA58AFC4DE (league_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
        $this->addSql('ALTER TABLE notification ADD CONSTRAINT FK_NOTIFICATION_REQUESTING_USER_ID FOREIGN KEY (requesting_user_id) REFERENCES user (id)');
        $this->addSql('ALTER TABLE notification ADD CONSTRAINT FK_NOTIFICATION_LEAGUE_ID FOREIGN KEY (league_id) REFERENCES league (id)');
        $this->addSql('ALTER TABLE league ADD matches_between_teams INT DEFAULT NULL, ADD blocked_match_dates JSON DEFAULT NULL');
        $this->addSql('ALTER TABLE log CHANGE payload payload LONGTEXT DEFAULT NULL');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE notification DROP FOREIGN KEY FK_NOTIFICATION_REQUESTING_USER_ID');
        $this->addSql('ALTER TABLE notification DROP FOREIGN KEY FK_NOTIFICATION_LEAGUE_ID');
        $this->addSql('DROP TABLE notification');
        $this->addSql('ALTER TABLE league DROP matches_between_teams, DROP blocked_match_dates');
        $this->addSql('ALTER TABLE log CHANGE payload payload JSON DEFAULT NULL');
    }
}
