<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20231011110332 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add tables_settings for the employee table';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('employee')->hasColumn('tables_settings'),
'The field tables_settings is already created in the employee table!'
);
$schema->getTable('employee')
->addColumn('tables_settings', Types::JSON, ['notnull' => false]);
}
public function down(Schema $schema): void
{
$this->skipIf(
false === $schema->getTable('employee')->hasColumn('tables_settings'),
'The field tables_settings doesn\'t exist on the employee table! '
);
$schema->getTable('employee')->dropColumn('tables_settings');
}
}