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