<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20230502155501 extends AbstractMigration
{
public function getDescription(): string
{
return 'Fix exported_to_v9_at to member_application';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('member_application')->hasColumn('exported_to_v9_at')
&&
Type::getType(Types::DATETIME_IMMUTABLE) === $schema->getTable('member_application')->getColumn('exported_to_v9_at')->getType(),
'The exported_to_v9_at field already is datetime'
);
$schema->getTable('member_application')
->getColumn('exported_to_v9_at')
->setType(Type::getType(Types::DATETIME_IMMUTABLE))
;
}
public function down(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('member_application')->hasColumn('exported_to_v9_at')
&&
Type::getType(Types::DATE_IMMUTABLE) === $schema->getTable('member_application')->getColumn('exported_to_v9_at')->getType(),
'The exported_to_v9_at field already is date'
);
$schema->getTable('member_application')
->getColumn('exported_to_v9_at')
->setType(Type::getType(Types::DATE_IMMUTABLE))
;
}
}