<?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 Version20260212123747 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_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');
$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');
$this->addSql('ALTER TABLE file_channel_export ADD CONSTRAINT FK_213095B172F5A1AA FOREIGN KEY (channel_id) REFERENCES channel_channels (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE file_channel_export ADD CONSTRAINT FK_213095B1BF396750 FOREIGN KEY (id) REFERENCES file (id) ON DELETE CASCADE');
$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');
$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');
$this->addSql('CREATE UNIQUE INDEX UNIQ_F20A41F450D3ADEF ON channel_user_data_cursus (cursus_progression_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE channel_user_data_cursus DROP FOREIGN KEY FK_F20A41F450D3ADEF');
$this->addSql('ALTER TABLE file_channel_export DROP FOREIGN KEY FK_213095B172F5A1AA');
$this->addSql('ALTER TABLE file_channel_export DROP FOREIGN KEY FK_213095B1BF396750');
$this->addSql('DROP TABLE channel_user_data_cursus_progress');
$this->addSql('DROP TABLE file_channel_export');
$this->addSql('DROP INDEX UNIQ_F20A41F450D3ADEF ON channel_user_data_cursus');
$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');
}
}