<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20250512131800 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add comment field to cmcm_request table';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('cmcm_request')->hasColumn('comment'),
'The comment field already exists in the cmcm_request table!'
);
$schema->getTable('cmcm_request')
->addColumn('comment', Types::TEXT)
->setDefault(null)
->setNotnull(false);
}
public function down(Schema $schema): void
{
$this->skipIf(
false === $schema->getTable('cmcm_request')->hasColumn('comment'),
'The comment field is already removed from the cmcm_request table!'
);
$schema->getTable('cmcm_request')
->dropColumn('comment');
}
}