migrations/Version20251208220000.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 Version20251208220000 extends AbstractMigration
  8. {
  9.     public function getDescription(): string
  10.     {
  11.         return 'Add internal_name field to mycmcm_request_category table';
  12.     }
  13.     public function up(Schema $schema): void
  14.     {
  15.         $table $schema->getTable('mycmcm_request_category');
  16.         $this->skipIf(
  17.             $table->hasColumn('internal_name'),
  18.             'The internal_name column already exists in the mycmcm_request_category table'
  19.         );
  20.         $table->addColumn('internal_name'Types::STRING)
  21.             ->setLength(100)
  22.             ->setNotnull(false);
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         $table $schema->getTable('mycmcm_request_category');
  27.         $this->skipIf(
  28.             !$table->hasColumn('internal_name'),
  29.             'The internal_name column does not exist in the mycmcm_request_category table'
  30.         );
  31.         $table->dropColumn('internal_name');
  32.     }
  33. }