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