<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20240704103300 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add total page count to cmcm request';
}
public function up(Schema $schema): void
{
$this->skipIf(
true === $schema->getTable('cmcm_request')->hasColumn('total_page_count'),
'The total_page_count field already exists in the cmcm_request table!'
);
$schema->getTable('cmcm_request')
->addColumn('total_page_count', Types::INTEGER)->setNotnull(true)->setDefault(0);
}
public function down(Schema $schema): void
{
$this->skipIf(
false === $schema->getTable('cmcm_request')->hasColumn('total_page_count'),
'The total_page_count is already removed from the cmcm_request table!'
);
$schema->getTable('cmcm_request')
->dropColumn('total_page_count');
}
}