<?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 Version20251217125501 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 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');
$this->addSql('ALTER TABLE channel_configuration ADD CONSTRAINT FK_47F466372F5A1AA FOREIGN KEY (channel_id) REFERENCES channel_channels (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE channel_configuration ADD CONSTRAINT FK_47F466343740E30 FOREIGN KEY (default_referral_trainer_id) REFERENCES account_users (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE channel_channels ADD configuration_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE channel_channels ADD CONSTRAINT FK_84A4911F73F32DD8 FOREIGN KEY (configuration_id) REFERENCES channel_configuration (id) ON DELETE SET NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_84A4911F73F32DD8 ON channel_channels (configuration_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE channel_channels DROP FOREIGN KEY FK_84A4911F73F32DD8');
$this->addSql('ALTER TABLE channel_configuration DROP FOREIGN KEY FK_47F466372F5A1AA');
$this->addSql('ALTER TABLE channel_configuration DROP FOREIGN KEY FK_47F466343740E30');
$this->addSql('DROP TABLE channel_configuration');
$this->addSql('DROP INDEX UNIQ_84A4911F73F32DD8 ON channel_channels');
$this->addSql('ALTER TABLE channel_channels DROP configuration_id');
}
}