<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20221103111400 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->skipIf(
false === $schema->getTable('tariff')->getColumn('available_from')->getNotnull(),
'The available_from column is already nullable in tariff table!'
);
$schema->getTable('tariff')
->getColumn('available_from')
->setNotnull(false);
$schema->getTable('tariff')
->getColumn('available_to')
->setNotnull(false);
}
public function down(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('tariff')->getColumn('available_from')->getNotnull(),
'The available_from column is already nullable in tariff table!'
);
$schema->getTable('tariff')
->getColumn('available_from')
->setNotnull(true);
$schema->getTable('tariff')
->getColumn('available_to')
->setNotnull(true);
}
}