<?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 Version20190222190247 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 user DROP FOREIGN KEY FK_8D93D64929D29E4D');
        $this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D6493D550E0D');
        $this->addSql('DROP INDEX IDX_8D93D6493D550E0D ON user');
        $this->addSql('DROP INDEX IDX_8D93D64929D29E4D ON user');
        $this->addSql('ALTER TABLE user ADD groupesgere_id INT DEFAULT NULL, ADD comptoirsgere_id INT DEFAULT NULL, DROP gestionnaire_groupe_id, DROP gestionnaire_comptoir_id');
        $this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D649F5100B17 FOREIGN KEY (groupesgere_id) REFERENCES groupe (id)');
        $this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D6495E8DB979 FOREIGN KEY (comptoirsgere_id) REFERENCES comptoir (id)');
        $this->addSql('CREATE INDEX IDX_8D93D649F5100B17 ON user (groupesgere_id)');
        $this->addSql('CREATE INDEX IDX_8D93D6495E8DB979 ON user (comptoirsgere_id)');
    }

    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 user DROP FOREIGN KEY FK_8D93D649F5100B17');
        $this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D6495E8DB979');
        $this->addSql('DROP INDEX IDX_8D93D649F5100B17 ON user');
        $this->addSql('DROP INDEX IDX_8D93D6495E8DB979 ON user');
        $this->addSql('ALTER TABLE user ADD gestionnaire_groupe_id INT DEFAULT NULL, ADD gestionnaire_comptoir_id INT DEFAULT NULL, DROP groupesgere_id, DROP comptoirsgere_id');
        $this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D64929D29E4D FOREIGN KEY (gestionnaire_groupe_id) REFERENCES groupe (id)');
        $this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D6493D550E0D FOREIGN KEY (gestionnaire_comptoir_id) REFERENCES comptoir (id)');
        $this->addSql('CREATE INDEX IDX_8D93D6493D550E0D ON user (gestionnaire_comptoir_id)');
        $this->addSql('CREATE INDEX IDX_8D93D64929D29E4D ON user (gestionnaire_groupe_id)');
    }
}
