migrations/Version20260408120000.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. final class Version20260408120000 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Add UUID to OIM stored_documents for SOB-like signed download links.';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql("ALTER TABLE stored_documents ADD uuid VARCHAR(36) DEFAULT NULL COMMENT 'UUID for file'");
  15.         $this->addSql("UPDATE stored_documents SET uuid = UUID() WHERE uuid IS NULL OR uuid = ''");
  16.         $this->addSql('ALTER TABLE stored_documents CHANGE uuid uuid VARCHAR(36) NOT NULL COMMENT \'UUID for file\'');
  17.         $this->addSql('CREATE UNIQUE INDEX UNIQ_STORED_DOCUMENTS_UUID ON stored_documents (uuid)');
  18.     }
  19.     public function down(Schema $schema): void
  20.     {
  21.         $this->addSql('DROP INDEX UNIQ_STORED_DOCUMENTS_UUID ON stored_documents');
  22.         $this->addSql('ALTER TABLE stored_documents DROP uuid');
  23.     }
  24. }