migrations/Version20260212123747.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20260212123747 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('CREATE TABLE channel_user_data_cursus_progress (id INT AUTO_INCREMENT NOT NULL, e_learning_percentage INT DEFAULT NULL, events_percentage INT DEFAULT NULL, total_percentage INT DEFAULT NULL, e_learning_total_time INT DEFAULT NULL, event_total_time INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE file_channel_export (id INT NOT NULL, channel_id VARCHAR(36) DEFAULT NULL, status VARCHAR(255) NOT NULL, payload LONGTEXT NOT NULL COMMENT \'(DC2Type:simple_array)\', options JSON DEFAULT NULL COMMENT \'(DC2Type:json)\', prepared INT NOT NULL, tag VARCHAR(255) NOT NULL, INDEX IDX_213095B172F5A1AA (channel_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE file_channel_export ADD CONSTRAINT FK_213095B172F5A1AA FOREIGN KEY (channel_id) REFERENCES channel_channels (id) ON DELETE CASCADE');
  21.         $this->addSql('ALTER TABLE file_channel_export ADD CONSTRAINT FK_213095B1BF396750 FOREIGN KEY (id) REFERENCES file (id) ON DELETE CASCADE');
  22.         $this->addSql('ALTER TABLE channel_user_data_cursus ADD cursus_progression_id INT DEFAULT NULL, DROP training_progression, DROP training_progression_updated_at, DROP physical_progression, DROP physical_progression_updated_at');
  23.         $this->addSql('ALTER TABLE channel_user_data_cursus ADD CONSTRAINT FK_F20A41F450D3ADEF FOREIGN KEY (cursus_progression_id) REFERENCES channel_user_data_cursus_progress (id) ON DELETE SET NULL');
  24.         $this->addSql('CREATE UNIQUE INDEX UNIQ_F20A41F450D3ADEF ON channel_user_data_cursus (cursus_progression_id)');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('ALTER TABLE channel_user_data_cursus DROP FOREIGN KEY FK_F20A41F450D3ADEF');
  30.         $this->addSql('ALTER TABLE file_channel_export DROP FOREIGN KEY FK_213095B172F5A1AA');
  31.         $this->addSql('ALTER TABLE file_channel_export DROP FOREIGN KEY FK_213095B1BF396750');
  32.         $this->addSql('DROP TABLE channel_user_data_cursus_progress');
  33.         $this->addSql('DROP TABLE file_channel_export');
  34.         $this->addSql('DROP INDEX UNIQ_F20A41F450D3ADEF ON channel_user_data_cursus');
  35.         $this->addSql('ALTER TABLE channel_user_data_cursus ADD training_progression_updated_at DATETIME DEFAULT NULL, ADD physical_progression INT DEFAULT NULL, ADD physical_progression_updated_at DATETIME DEFAULT NULL, CHANGE cursus_progression_id training_progression INT DEFAULT NULL');
  36.     }
  37. }