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