migrations/Version20230524094906.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\Migrations\AbstractMigration;
  6. final class Version20230524094906 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Add is_removed field for the health_mutual table';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->skipIf(
  15.             true === $schema->getTable('health_mutual')->hasColumn('is_removed'),
  16.             'The is_removed field already set in the health_mutual table!'
  17.         );
  18.         $schema->getTable('health_mutual')
  19.             ->addColumn('is_removed''boolean', ['notnull' => true'default' => false]);
  20.     }
  21.     public function down(Schema $schema): void
  22.     {
  23.         $this->skipIf(
  24.             false === $schema->getTable('health_mutual')->hasColumn('is_removed'),
  25.             'The is_removed is already removed from the health_mutual table!'
  26.         );
  27.         $schema->getTable('health_mutual')->dropColumn('is_removed');
  28.     }
  29. }