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