<?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 Version20190709074503 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE link_check DROP FOREIGN KEY FK_9335F0CDADA40271');
        $this->addSql('ALTER TABLE link_check ADD CONSTRAINT FK_9335F0CDADA40271 FOREIGN KEY (link_id) REFERENCES link (id) ON DELETE CASCADE');
        $this->addSql('ALTER TABLE link DROP FOREIGN KEY FK_36AC99F14A8DFB0C');
        $this->addSql('ALTER TABLE link ADD CONSTRAINT FK_36AC99F14A8DFB0C FOREIGN KEY (fail_check_id) REFERENCES link_check (id) ON DELETE SET NULL');
    }

    public function down(Schema $schema) : void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE link DROP FOREIGN KEY FK_36AC99F14A8DFB0C');
        $this->addSql('ALTER TABLE link ADD CONSTRAINT FK_36AC99F14A8DFB0C FOREIGN KEY (fail_check_id) REFERENCES link_check (id)');
        $this->addSql('ALTER TABLE link_check DROP FOREIGN KEY FK_9335F0CDADA40271');
        $this->addSql('ALTER TABLE link_check ADD CONSTRAINT FK_9335F0CDADA40271 FOREIGN KEY (link_id) REFERENCES link (id)');
    }
}
