migrations/Version20221018125023.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 Version20221018125023 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->hasTable('member_application_reminder'),
  17.             'The member_application_reminder table already exists.'
  18.         );
  19.         $schema
  20.             ->getTable('member_application')->dropColumn('reminded_at');
  21.         $table $schema->createTable('member_application_reminder');
  22.         $table->addColumn('id'Types::GUID)->setNotnull(true);
  23.         $table->setPrimaryKey(['id']);
  24.         $table
  25.             ->addColumn('member_application_id'Types::STRING)
  26.             ->setNotnull(true);
  27.         $table
  28.             ->addColumn('type'Types::STRING)
  29.             ->setNotnull(true);
  30.         $table
  31.             ->addColumn('sent_at'Types::DATETIME_IMMUTABLE)
  32.             ->setNotnull(true);
  33.         $table->addForeignKeyConstraint(
  34.             'member_application',
  35.             ['member_application_id'],
  36.             ['id'],
  37.             [],
  38.             'fk_member_application_member_application_reminder'
  39.         );
  40.     }
  41.     public function down(Schema $schema): void
  42.     {
  43.         $this->skipIf(
  44.             false === $schema->hasTable('member_application_reminder'),
  45.             'The member_application_reminder table is already removed.'
  46.         );
  47.         $schema->dropTable('member_application_reminder');
  48.         $schema
  49.             ->getTable('member_application')
  50.             ->addColumn('reminded_at'Types::DATETIME_IMMUTABLE)
  51.             ->setNotnull(false);
  52.     }
  53. }