<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20230327150501 extends AbstractMigration
{
public function getDescription(): string
{
return 'Update is_condition_accepted field to is_condition_acceptedLine the member_application table';
}
public function up(Schema $schema): void
{
$this->skipIf(
false === $schema->getTable('member_application')->hasColumn('is_condition_accepted'),
'The is_condition_accepted is already removed from the member_application table!'
);
$schema->getTable('member_application')->dropColumn('is_condition_accepted');
}
public function down(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('member_application')->hasColumn('is_condition_accepted'),
'The is_condition_accepted is already set in the member_application table!'
);
$schema->getTable('member_application')
->addColumn('is_condition_accepted', Types::BOOLEAN)
->setDefault(false)
->setNotnull(true);
}
public function postDown(Schema $schema): void
{
$this->connection->executeQuery('UPDATE member_application SET is_condition_accepted=is_general_condition_accepted');
}
}