migrations/Version20220718072301.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 Version20220718072301 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 (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, firstname VARCHAR(255) DEFAULT NULL, lastname VARCHAR(255) DEFAULT NULL, address VARCHAR(255) DEFAULT NULL, postcode VARCHAR(255) DEFAULT NULL, city VARCHAR(255) DEFAULT NULL, phone VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_C7440455A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('CREATE TABLE formation (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, introduction LONGTEXT DEFAULT NULL, description LONGTEXT DEFAULT NULL, meta_description LONGTEXT DEFAULT NULL, picture VARCHAR(255) DEFAULT NULL, picture_alt VARCHAR(255) DEFAULT NULL, price_ht DOUBLE PRECISION DEFAULT NULL, tva DOUBLE PRECISION DEFAULT NULL, during VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('CREATE TABLE formation_capsule (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, video VARCHAR(255) DEFAULT NULL, file VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('CREATE TABLE formation_level (id INT AUTO_INCREMENT NOT NULL, formation_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, level INT DEFAULT NULL, INDEX IDX_EC6152665200282E (formation_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('CREATE TABLE formation_review (id INT AUTO_INCREMENT NOT NULL, formation_id INT DEFAULT NULL, rating INT DEFAULT NULL, comment LONGTEXT DEFAULT NULL, INDEX IDX_595A8FEB5200282E (formation_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('CREATE TABLE formation_section (id INT AUTO_INCREMENT NOT NULL, formation_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, INDEX IDX_688C3F945200282E (formation_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('CREATE TABLE formation_section_formation_capsule (formation_section_id INT NOT NULL, formation_capsule_id INT NOT NULL, INDEX IDX_494A108D208B3043 (formation_section_id), INDEX IDX_494A108D89EFD7D0 (formation_capsule_id), PRIMARY KEY(formation_section_id, formation_capsule_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $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) DEFAULT NULL, INDEX IDX_D5184C8E714704E9 (capsule_id), INDEX IDX_D5184C8E5200282E (formation_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('ALTER TABLE client ADD CONSTRAINT FK_C7440455A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
            $this->addSql('ALTER TABLE formation_level ADD CONSTRAINT FK_EC6152665200282E FOREIGN KEY (formation_id) REFERENCES formation (id)');
            $this->addSql('ALTER TABLE formation_review ADD CONSTRAINT FK_595A8FEB5200282E FOREIGN KEY (formation_id) REFERENCES formation (id)');
            $this->addSql('ALTER TABLE formation_section ADD CONSTRAINT FK_688C3F945200282E FOREIGN KEY (formation_id) REFERENCES formation (id)');
            $this->addSql('ALTER TABLE formation_section_formation_capsule ADD CONSTRAINT FK_494A108D208B3043 FOREIGN KEY (formation_section_id) REFERENCES formation_section (id) ON DELETE CASCADE');
            $this->addSql('ALTER TABLE formation_section_formation_capsule ADD CONSTRAINT FK_494A108D89EFD7D0 FOREIGN KEY (formation_capsule_id) REFERENCES formation_capsule (id) ON DELETE CASCADE');
            $this->addSql('ALTER TABLE formation_state ADD CONSTRAINT FK_D5184C8E714704E9 FOREIGN KEY (capsule_id) REFERENCES formation_capsule (id)');
            $this->addSql('ALTER TABLE formation_state ADD CONSTRAINT FK_D5184C8E5200282E FOREIGN KEY (formation_id) REFERENCES 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_level DROP FOREIGN KEY FK_EC6152665200282E');
            $this->addSql('ALTER TABLE formation_review DROP FOREIGN KEY FK_595A8FEB5200282E');
            $this->addSql('ALTER TABLE formation_section DROP FOREIGN KEY FK_688C3F945200282E');
            $this->addSql('ALTER TABLE formation_state DROP FOREIGN KEY FK_D5184C8E5200282E');
            $this->addSql('ALTER TABLE formation_section_formation_capsule DROP FOREIGN KEY FK_494A108D89EFD7D0');
            $this->addSql('ALTER TABLE formation_state DROP FOREIGN KEY FK_D5184C8E714704E9');
            $this->addSql('ALTER TABLE formation_section_formation_capsule DROP FOREIGN KEY FK_494A108D208B3043');
            $this->addSql('DROP TABLE client');
            $this->addSql('DROP TABLE formation');
            $this->addSql('DROP TABLE formation_capsule');
            $this->addSql('DROP TABLE formation_level');
            $this->addSql('DROP TABLE formation_review');
            $this->addSql('DROP TABLE formation_section');
            $this->addSql('DROP TABLE formation_section_formation_capsule');
            $this->addSql('DROP TABLE formation_state');
        }
    }