<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20230913103100 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add o_auth_code_verifier field for the mycmcm_user table';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('mycmcm_user')->hasColumn('o_auth_code_verifier'),
'The o_auth_code_verifier field already set in the mycmcm_user table!'
);
$schema->getTable('mycmcm_user')
->addColumn('o_auth_code_verifier', Types::STRING, ['notnull' => false, 'default' => null]);
$schema->getTable('mycmcm_user')
->addColumn('o_auth_identification_key', Types::STRING, ['notnull' => false, 'default' => null]);
}
public function down(Schema $schema): void
{
$this->skipIf(
false === $schema->getTable('mycmcm_user')->hasColumn('o_auth_code_verifier'),
'The o_auth_code_verifier is already removed from the mycmcm_user table!'
);
$schema->getTable('mycmcm_user')->dropColumn('o_auth_code_verifier');
$schema->getTable('mycmcm_user')->dropColumn('o_auth_identification_key');
}
}