migrations/Version20251015181527.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 Version20251015181527 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $this->addSql('ALTER TABLE tourapp.travel ADD reference VARCHAR(36) DEFAULT NULL;');
  18.         $this->addSql('update tourapp.travel set reference = (travel_focus_id || \'-\' || travel_id);');
  19.         $this->addSql('ALTER TABLE tourapp.travel ALTER COLUMN reference SET NOT NULL;');
  20.         $this->addSql('CREATE UNIQUE INDEX UNIQ_70C1E283AEA34913 ON tourapp.travel (reference)');
  21.         $this->addSql('ALTER TABLE tourapp.travel_members ADD reference VARCHAR(36) DEFAULT NULL');
  22.         $this->addSql('update tourapp.travel_members set reference = (travel_focus_id || \'-\' || travel_member_id);');
  23.         $this->addSql('ALTER TABLE tourapp.travel_members ALTER COLUMN reference SET NOT NULL;');
  24.         $this->addSql('CREATE UNIQUE INDEX UNIQ_5B052B5BAEA34913 ON tourapp.travel_members (reference)');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {}
  28. }