<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20240626155500 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add contract number to cmcm request';
}
public function up(Schema $schema): void
{
$this->skipIf($schema->getTable('cmcm_request')->hasColumn('contract_number'), 'Table cmcm_request already have contract_number column');
$table = $schema->getTable('cmcm_request');
$table->addColumn('contract_number', Types::STRING, ['length' => 20])->setNotnull(false);
}
public function down(Schema $schema): void
{
$this->skipIf(!$schema->getTable('cmcm_request')->hasColumn('contract_number'), 'Table cmcm_request does not have contract_number column');
$schema->getTable('cmcm_request')->dropColumn('contract_number');
}
}