<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20230207131856 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('company')->hasColumn('is_employee_id_required'),
'The is_employee_id_required field already exists in the company table!'
);
$table = $schema->getTable('company');
$table
->addColumn('is_employee_id_required', Types::BOOLEAN)
->setDefault(false)
;
}
public function down(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('company')->hasColumn('is_employee_id_required'),
'The is_employee_id_required field is already dropped from the the company table!'
);
$this->addSql('ALTER TABLE company DROP is_employee_id_required');
$table = $schema->getTable('company');
$table
->dropColumn('is_employee_id_required');
}
}