<?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 Version20260326161052 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('ALTER TABLE channel_company ADD uuid VARCHAR(36) DEFAULT UUID() AFTER id');
$this->addSql('ALTER TABLE channel_company_channel_user_data ADD company_uuid VARCHAR(36) DEFAULT NULL AFTER id');
$this->addSql('ALTER TABLE channel_user_data_cursus_internship ADD company_uuid VARCHAR(36) DEFAULT NULL AFTER cursus_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE channel_company DROP uuid');
$this->addSql('ALTER TABLE channel_company_channel_user_data DROP company_uuid');
$this->addSql('ALTER TABLE channel_user_data_cursus_internship DROP company_uuid');
}
public function postUp(Schema $schema): void
{
$this->connection->executeStatement(
'UPDATE channel_company_channel_user_data ccud
JOIN channel_company c
ON c.id = ccud.company_id SET ccud.company_uuid = c.uuid'
);
$this->connection->executeStatement(
'UPDATE channel_user_data_cursus_internship ci
JOIN channel_company c
ON c.id = ci.company_id SET ci.company_uuid = c.uuid'
);
}
}