<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20221018125023 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->hasTable('member_application_reminder'),
'The member_application_reminder table already exists.'
);
$schema
->getTable('member_application')->dropColumn('reminded_at');
$table = $schema->createTable('member_application_reminder');
$table->addColumn('id', Types::GUID)->setNotnull(true);
$table->setPrimaryKey(['id']);
$table
->addColumn('member_application_id', Types::STRING)
->setNotnull(true);
$table
->addColumn('type', Types::STRING)
->setNotnull(true);
$table
->addColumn('sent_at', Types::DATETIME_IMMUTABLE)
->setNotnull(true);
$table->addForeignKeyConstraint(
'member_application',
['member_application_id'],
['id'],
[],
'fk_member_application_member_application_reminder'
);
}
public function down(Schema $schema): void
{
$this->skipIf(
false === $schema->hasTable('member_application_reminder'),
'The member_application_reminder table is already removed.'
);
$schema->dropTable('member_application_reminder');
$schema
->getTable('member_application')
->addColumn('reminded_at', Types::DATETIME_IMMUTABLE)
->setNotnull(false);
}
}