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