migrations/Version20220725101942.php line 1

Open in your IDE?
  1. <?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 Version20220725101942 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 formation ADD level_id INT DEFAULT NULL');
            $this->addSql('ALTER TABLE formation ADD CONSTRAINT FK_404021BF5FB14BA7 FOREIGN KEY (level_id) REFERENCES formation_level (id)');
            $this->addSql('CREATE INDEX IDX_404021BF5FB14BA7 ON formation (level_id)');
            $this->addSql('ALTER TABLE formation_level DROP FOREIGN KEY FK_EC6152665200282E');
            $this->addSql('DROP INDEX IDX_EC6152665200282E ON formation_level');
            $this->addSql('ALTER TABLE formation_level DROP formation_id');
        }
    
        public function down(Schema $schema): void
        {
            // this down() migration is auto-generated, please modify it to your needs
            $this->addSql('ALTER TABLE formation DROP FOREIGN KEY FK_404021BF5FB14BA7');
            $this->addSql('DROP INDEX IDX_404021BF5FB14BA7 ON formation');
            $this->addSql('ALTER TABLE formation DROP level_id');
            $this->addSql('ALTER TABLE formation_level ADD formation_id INT DEFAULT NULL');
            $this->addSql('ALTER TABLE formation_level ADD CONSTRAINT FK_EC6152665200282E FOREIGN KEY (formation_id) REFERENCES formation (id)');
            $this->addSql('CREATE INDEX IDX_EC6152665200282E ON formation_level (formation_id)');
        }
    }