<?php
declare(strict_types=1);
/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add ranking column to dtb_product table
*/
final class Version20251113150210 extends AbstractMigration
{
public function up(Schema $schema): void
{
// Check if column already exists
$table = $schema->getTable('dtb_product');
if (!$table->hasColumn('ranking')) {
$this->addSql("ALTER TABLE dtb_product ADD ranking INT DEFAULT NULL");
}
}
public function down(Schema $schema): void
{
// Remove column if exists
$table = $schema->getTable('dtb_product');
if ($table->hasColumn('ranking')) {
$this->addSql("ALTER TABLE dtb_product DROP COLUMN ranking");
}
}
}