Version20190122155645.php 3.66 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
<?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 Version20190122155645 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 flux ADD adherent_id INT DEFAULT NULL, ADD prestataire_id INT DEFAULT NULL, ADD prestataire_dest_id INT DEFAULT NULL, ADD comptoir_id INT DEFAULT NULL, ADD groupe_id INT DEFAULT NULL, ADD siege_id INT DEFAULT NULL, DROP expediteur, DROP destinataire, CHANGE type type VARCHAR(200) NOT NULL');
        $this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313A25F06C53 FOREIGN KEY (adherent_id) REFERENCES adherent (id)');
        $this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313ABE3DB2B7 FOREIGN KEY (prestataire_id) REFERENCES prestataire (id)');
        $this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313AECEF536E FOREIGN KEY (prestataire_dest_id) REFERENCES prestataire (id)');
        $this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313AAEB0C1F5 FOREIGN KEY (comptoir_id) REFERENCES comptoir (id)');
        $this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313A7A45358C FOREIGN KEY (groupe_id) REFERENCES groupe (id)');
        $this->addSql('ALTER TABLE flux ADD CONSTRAINT FK_7252313ABF006E8B FOREIGN KEY (siege_id) REFERENCES siege (id)');
        $this->addSql('CREATE INDEX IDX_7252313A25F06C53 ON flux (adherent_id)');
        $this->addSql('CREATE INDEX IDX_7252313ABE3DB2B7 ON flux (prestataire_id)');
        $this->addSql('CREATE INDEX IDX_7252313AECEF536E ON flux (prestataire_dest_id)');
        $this->addSql('CREATE INDEX IDX_7252313AAEB0C1F5 ON flux (comptoir_id)');
        $this->addSql('CREATE INDEX IDX_7252313A7A45358C ON flux (groupe_id)');
        $this->addSql('CREATE INDEX IDX_7252313ABF006E8B ON flux (siege_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 flux DROP FOREIGN KEY FK_7252313A25F06C53');
        $this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313ABE3DB2B7');
        $this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313AECEF536E');
        $this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313AAEB0C1F5');
        $this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313A7A45358C');
        $this->addSql('ALTER TABLE flux DROP FOREIGN KEY FK_7252313ABF006E8B');
        $this->addSql('DROP INDEX IDX_7252313A25F06C53 ON flux');
        $this->addSql('DROP INDEX IDX_7252313ABE3DB2B7 ON flux');
        $this->addSql('DROP INDEX IDX_7252313AECEF536E ON flux');
        $this->addSql('DROP INDEX IDX_7252313AAEB0C1F5 ON flux');
        $this->addSql('DROP INDEX IDX_7252313A7A45358C ON flux');
        $this->addSql('DROP INDEX IDX_7252313ABF006E8B ON flux');
        $this->addSql('ALTER TABLE flux ADD expediteur VARCHAR(100) NOT NULL COLLATE utf8_general_ci, ADD destinataire VARCHAR(100) NOT NULL COLLATE utf8_general_ci, DROP adherent_id, DROP prestataire_id, DROP prestataire_dest_id, DROP comptoir_id, DROP groupe_id, DROP siege_id, CHANGE type type VARCHAR(3) NOT NULL COLLATE utf8_general_ci');
    }
}