migrations/Version20250728110001.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 Version20250728110001 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Make process_type column NOT NULL in dossier_type table';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->skipIf(
  15.             !$schema->getTable('dossier_type')->hasColumn('process_type'),
  16.             'The process_type column does not exist in the dossier_type table'
  17.         );
  18.         // Make process_type NOT NULL
  19.         $table $schema->getTable('dossier_type');
  20.         $table->getColumn('process_type')->setNotnull(true);
  21.     }
  22.     public function down(Schema $schema): void
  23.     {
  24.         $this->skipIf(
  25.             !$schema->getTable('dossier_type')->hasColumn('process_type'),
  26.             'The process_type column does not exist in the dossier_type table'
  27.         );
  28.         // Make process_type nullable again
  29.         $table $schema->getTable('dossier_type');
  30.         $table->getColumn('process_type')->setNotnull(false);
  31.     }
  32. }