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