migrations/Version20250722093712.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 Version20250722093712 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_certificates_cursus_start (id INT NOT NULL, organization_id INT NOT NULL, body TEXT DEFAULT NULL, UNIQUE INDEX UNIQ_3F945E7832C8A3DE (organization_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE channel_certificates_cursus_start ADD CONSTRAINT FK_3F945E7832C8A3DE FOREIGN KEY (organization_id) REFERENCES channel_organizations (id) ON DELETE CASCADE');
  20.         $this->addSql('ALTER TABLE channel_certificates_cursus_start ADD CONSTRAINT FK_3F945E78BF396750 FOREIGN KEY (id) REFERENCES channel_certificates (id) ON DELETE CASCADE');
  21.         $this->addSql('ALTER TABLE channel_certificates DROP FOREIGN KEY FK_C15631FE32C8A3DE');
  22.         $this->addSql('DROP INDEX UNIQ_C15631FE32C8A3DE ON channel_certificates');
  23.         $this->addSql('ALTER TABLE channel_certificates ADD type VARCHAR(255) NOT NULL, DROP organization_id, DROP body');
  24.         $this->addSql('CREATE UNIQUE INDEX UNIQ_537D9B39A7A91E0B ON channel_white_label (domain)');
  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_certificates_cursus_start DROP FOREIGN KEY FK_3F945E7832C8A3DE');
  30.         $this->addSql('ALTER TABLE channel_certificates_cursus_start DROP FOREIGN KEY FK_3F945E78BF396750');
  31.         $this->addSql('DROP TABLE channel_certificates_cursus_start');
  32.         $this->addSql('ALTER TABLE channel_certificates ADD organization_id INT NOT NULL, ADD body TEXT DEFAULT NULL, DROP type');
  33.         $this->addSql('ALTER TABLE channel_certificates ADD CONSTRAINT FK_C15631FE32C8A3DE FOREIGN KEY (organization_id) REFERENCES channel_organizations (id) ON DELETE CASCADE');
  34.         $this->addSql('CREATE UNIQUE INDEX UNIQ_C15631FE32C8A3DE ON channel_certificates (organization_id)');
  35.         $this->addSql('DROP INDEX UNIQ_537D9B39A7A91E0B ON channel_white_label');
  36.     }
  37. }