<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20251209140000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add sort_order field to mycmcm_request_category table';
}
public function up(Schema $schema): void
{
$table = $schema->getTable('mycmcm_request_category');
$this->skipIf(
$table->hasColumn('sort_order'),
'The sort_order column already exists in the mycmcm_request_category table'
);
$table->addColumn('sort_order', Types::INTEGER)
->setNotnull(true)
->setDefault(0);
}
public function down(Schema $schema): void
{
$table = $schema->getTable('mycmcm_request_category');
$this->skipIf(
!$table->hasColumn('sort_order'),
'The sort_order column does not exist in the mycmcm_request_category table'
);
$table->dropColumn('sort_order');
}
}