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