migrations/Version20251217125501.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 Version20251217125501 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_configuration (id INT AUTO_INCREMENT NOT NULL, channel_id VARCHAR(36) NOT NULL, default_referral_trainer_id VARCHAR(36) DEFAULT NULL, timezone VARCHAR(50) DEFAULT NULL, show_positioning_test_results TINYINT(1) DEFAULT 0 NOT NULL, planning_days LONGTEXT DEFAULT \'1,2,3,4,5\' NOT NULL COMMENT \'(DC2Type:simple_array)\', UNIQUE INDEX UNIQ_47F466372F5A1AA (channel_id), INDEX IDX_47F466343740E30 (default_referral_trainer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19. $this->addSql('ALTER TABLE channel_configuration ADD CONSTRAINT FK_47F466372F5A1AA FOREIGN KEY (channel_id) REFERENCES channel_channels (id) ON DELETE CASCADE');
  20. $this->addSql('ALTER TABLE channel_configuration ADD CONSTRAINT FK_47F466343740E30 FOREIGN KEY (default_referral_trainer_id) REFERENCES account_users (id) ON DELETE SET NULL');
  21. $this->addSql('ALTER TABLE channel_channels ADD configuration_id INT DEFAULT NULL');
  22. $this->addSql('ALTER TABLE channel_channels ADD CONSTRAINT FK_84A4911F73F32DD8 FOREIGN KEY (configuration_id) REFERENCES channel_configuration (id) ON DELETE SET NULL');
  23. $this->addSql('CREATE UNIQUE INDEX UNIQ_84A4911F73F32DD8 ON channel_channels (configuration_id)');
  24. }
  25. public function down(Schema $schema): void
  26. {
  27. // this down() migration is auto-generated, please modify it to your needs
  28. $this->addSql('ALTER TABLE channel_channels DROP FOREIGN KEY FK_84A4911F73F32DD8');
  29. $this->addSql('ALTER TABLE channel_configuration DROP FOREIGN KEY FK_47F466372F5A1AA');
  30. $this->addSql('ALTER TABLE channel_configuration DROP FOREIGN KEY FK_47F466343740E30');
  31. $this->addSql('DROP TABLE channel_configuration');
  32. $this->addSql('DROP INDEX UNIQ_84A4911F73F32DD8 ON channel_channels');
  33. $this->addSql('ALTER TABLE channel_channels DROP configuration_id');
  34. }
  35. }