<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20250728110001 extends AbstractMigration
{
public function getDescription(): string
{
return 'Make process_type column NOT NULL in dossier_type table';
}
public function up(Schema $schema): void
{
$this->skipIf(
!$schema->getTable('dossier_type')->hasColumn('process_type'),
'The process_type column does not exist in the dossier_type table'
);
// Make process_type NOT NULL
$table = $schema->getTable('dossier_type');
$table->getColumn('process_type')->setNotnull(true);
}
public function down(Schema $schema): void
{
$this->skipIf(
!$schema->getTable('dossier_type')->hasColumn('process_type'),
'The process_type column does not exist in the dossier_type table'
);
// Make process_type nullable again
$table = $schema->getTable('dossier_type');
$table->getColumn('process_type')->setNotnull(false);
}
}