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