migrations/Version20221121173543.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\Type;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\Migrations\AbstractMigration;
  8. final class Version20221121173543 extends AbstractMigration
  9. {
  10.     public function getDescription(): string
  11.     {
  12.         return 'Changes the avatar_image_url fields to text in company_user, health_mutual_user, mycmcm_user, public_api_user tables!';
  13.     }
  14.     public function up(Schema $schema): void
  15.     {
  16.         $this->skipIf(
  17.             $schema->getTable('company_user')->getColumn('avatar_image_url')->getType() === Type::getType(Types::TEXT),
  18.             'The company_user table\'s avatar_image_url field was already converted to text type!'
  19.         );
  20.         $schema->getTable('company_user')->getColumn('avatar_image_url')->setType(Type::getType(Types::TEXT));
  21.         $schema->getTable('health_mutual_user')->getColumn('avatar_image_url')->setType(Type::getType(Types::TEXT));
  22.         $schema->getTable('mycmcm_user')->getColumn('avatar_image_url')->setType(Type::getType(Types::TEXT));
  23.         $schema->getTable('public_api_user')->getColumn('avatar_image_url')->setType(Type::getType(Types::TEXT));
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.     }
  28. }