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