<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230116130713 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add status to ticket - part 2';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('ticket')->getColumn('status')->getNotnull(),
'The status field already set to not null!'
);
$schema->getTable('ticket')
->getColumn('status')
->setNotnull(true);
}
public function down(Schema $schema): void
{
$this->skipIf(
false === $schema->getTable('ticket')->hasColumn('status'),
'The status is already removed from the ticket table!'
);
$schema->getTable('ticket')
->getColumn('status')
->setNotnull(false);
}
}