migrations/Version20220718080423.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 Version20220718080423 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 client_formation (client_id INT NOT NULL, formation_id INT NOT NULL, INDEX IDX_AB60F1B019EB6921 (client_id), INDEX IDX_AB60F1B05200282E (formation_id), PRIMARY KEY(client_id, formation_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('CREATE TABLE formation_step (id INT AUTO_INCREMENT NOT NULL, section_id INT DEFAULT NULL, capsule_id INT DEFAULT NULL, state VARCHAR(255) DEFAULT NULL, list_order INT DEFAULT NULL, INDEX IDX_14661B7CD823E37A (section_id), INDEX IDX_14661B7C714704E9 (capsule_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('ALTER TABLE client_formation ADD CONSTRAINT FK_AB60F1B019EB6921 FOREIGN KEY (client_id) REFERENCES client (id) ON DELETE CASCADE');
            $this->addSql('ALTER TABLE client_formation ADD CONSTRAINT FK_AB60F1B05200282E FOREIGN KEY (formation_id) REFERENCES formation (id) ON DELETE CASCADE');
            $this->addSql('ALTER TABLE formation_step ADD CONSTRAINT FK_14661B7CD823E37A FOREIGN KEY (section_id) REFERENCES formation_section (id)');
            $this->addSql('ALTER TABLE formation_step ADD CONSTRAINT FK_14661B7C714704E9 FOREIGN KEY (capsule_id) REFERENCES formation_capsule (id)');
            $this->addSql('DROP TABLE formation_state');
        }
    
        public function down(Schema $schema): void
        {
            // this down() migration is auto-generated, please modify it to your needs
            $this->addSql('CREATE TABLE formation_state (id INT AUTO_INCREMENT NOT NULL, capsule_id INT DEFAULT NULL, formation_id INT DEFAULT NULL, state VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, INDEX IDX_D5184C8E5200282E (formation_id), INDEX IDX_D5184C8E714704E9 (capsule_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
            $this->addSql('ALTER TABLE formation_state ADD CONSTRAINT FK_D5184C8E5200282E FOREIGN KEY (formation_id) REFERENCES formation (id)');
            $this->addSql('ALTER TABLE formation_state ADD CONSTRAINT FK_D5184C8E714704E9 FOREIGN KEY (capsule_id) REFERENCES formation_capsule (id)');
            $this->addSql('DROP TABLE client_formation');
            $this->addSql('DROP TABLE formation_step');
        }
    }