migrations/Version20260326161052.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 Version20260326161052 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('ALTER TABLE channel_company ADD uuid VARCHAR(36) DEFAULT UUID() AFTER id');
  19. $this->addSql('ALTER TABLE channel_company_channel_user_data ADD company_uuid VARCHAR(36) DEFAULT NULL AFTER id');
  20. $this->addSql('ALTER TABLE channel_user_data_cursus_internship ADD company_uuid VARCHAR(36) DEFAULT NULL AFTER cursus_id');
  21. }
  22. public function down(Schema $schema): void
  23. {
  24. // this down() migration is auto-generated, please modify it to your needs
  25. $this->addSql('ALTER TABLE channel_company DROP uuid');
  26. $this->addSql('ALTER TABLE channel_company_channel_user_data DROP company_uuid');
  27. $this->addSql('ALTER TABLE channel_user_data_cursus_internship DROP company_uuid');
  28. }
  29. public function postUp(Schema $schema): void
  30. {
  31. $this->connection->executeStatement(
  32. 'UPDATE channel_company_channel_user_data ccud
  33. JOIN channel_company c
  34. ON c.id = ccud.company_id SET ccud.company_uuid = c.uuid'
  35. );
  36. $this->connection->executeStatement(
  37. 'UPDATE channel_user_data_cursus_internship ci
  38. JOIN channel_company c
  39. ON c.id = ci.company_id SET ci.company_uuid = c.uuid'
  40. );
  41. }
  42. }