<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20240220164400 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add is_enabled to employee.';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('employee')->hasColumn('is_enabled'),
'The is_enabled column was already added to employee table!'
);
$memberApplicationTable = $schema->getTable('employee');
$memberApplicationTable->addColumn('is_enabled', Types::BOOLEAN)->setNotnull(true)->setDefault(true);
}
public function down(Schema $schema): void
{
$this->skipIf(
false === $schema->getTable('employee')->hasColumn('is_enabled'),
'The is_enabled column was already removed to employee table!'
);
$memberApplicationTable = $schema->getTable('employee');
$memberApplicationTable->dropColumn('is_enabled');
}
}