migrations/Version20260619140108.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 Version20260619140108 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('DROP INDEX `primary` ON channel_contacts');
  19. $this->addSql('ALTER TABLE channel_contacts ADD id VARCHAR(36) DEFAULT NULL, ADD archived_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
  20. $this->addSql('UPDATE channel_contacts SET id = UUID() WHERE id IS NULL');
  21. $this->addSql('ALTER TABLE channel_contacts CHANGE id id VARCHAR(36) NOT NULL');
  22. $this->addSql('CREATE UNIQUE INDEX UNIQ_44F066DA72F5A1AAE7A1254A ON channel_contacts (channel_id, contact_id)');
  23. $this->addSql('ALTER TABLE channel_contacts ADD PRIMARY KEY (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('DROP INDEX UNIQ_44F066DA72F5A1AAE7A1254A ON channel_contacts');
  29. $this->addSql('DROP INDEX `PRIMARY` ON channel_contacts');
  30. $this->addSql('ALTER TABLE channel_contacts DROP id, DROP archived_at');
  31. $this->addSql('ALTER TABLE channel_contacts ADD PRIMARY KEY (contact_id, channel_id)');
  32. }
  33. }