migrations/Version20250422101900.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 Version20250422101900 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('cmcm_comment'),
  17.             'The cmcm_comment column was already added to member_application table!'
  18.         );
  19.         $commentTable $schema->getTable('member_application');
  20.         $commentTable->addColumn('cmcm_comment'Types::TEXT)->setNotnull(false);
  21.     }
  22.     public function down(Schema $schema): void
  23.     {
  24.         $this->skipIf(
  25.             false === $schema->getTable('member_application')->hasColumn('cmcm_comment'),
  26.             'The cmcm_comment column was already removed to member_application table!'
  27.         );
  28.         $commentTable $schema->getTable('member_application');
  29.         $commentTable->dropColumn('cmcm_comment');
  30.     }
  31. }