migrations/Version20221007075007.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\Migrations\AbstractMigration;
  7. final class Version20221007075007 extends AbstractMigration
  8. {
  9.     public function getDescription(): string
  10.     {
  11.         return '';
  12.     }
  13.     public function up(Schema $schema): void
  14.     {
  15.         $this->skipIf(
  16.             true === $schema->getTable('member_application')->hasColumn('email_confirmed_at'),
  17.             'The email_confirmed_at field already exists in the member_application table!'
  18.         );
  19.         $schema->getTable('member_application')->addColumn('email_confirmed_at'Types::DATETIME_IMMUTABLE)->setNotnull(false);
  20.     }
  21.     public function down(Schema $schema): void
  22.     {
  23.         $this->skipIf(
  24.             false === $schema->getTable('member_application')->hasColumn('email_confirmed_at'),
  25.             'The email_confirmed_at is already removed from the member_application table!'
  26.         );
  27.         $schema->getTable('member_application')->dropColumn('email_confirmed_at');
  28.     }
  29. }