<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20250814212539 extends AbstractMigration
{
public function getDescription(): string
{
return 'Increase inquiry.ged_id column length from 50 to 255';
}
public function up(Schema $schema): void
{
$this->skipIf(
!$schema->hasTable('inquiry')
|| 255 === $schema->getTable('inquiry')->getColumn('ged_id')->getLength(),
'Table inquiry does not exist or ged_id column length is already 255'
);
// Change column length from 50 to 255
$table = $schema->getTable('inquiry');
$table->getColumn('ged_id')->setLength(255);
}
public function down(Schema $schema): void
{
$this->skipIf(
!$schema->hasTable('inquiry')
|| 50 === $schema->getTable('inquiry')->getColumn('ged_id')->getLength(),
'Table inquiry does not exist or ged_id column length is already 50'
);
// Revert column length back to 50
$table = $schema->getTable('inquiry');
$table->getColumn('ged_id')->setLength(50);
}
}