<?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 comment_detail and product_details_info columns to dtb_product table
*/
final class Version20251113142838 extends AbstractMigration
{
public function up(Schema $schema): void
{
// Check if column already exists
$table = $schema->getTable('dtb_product');
if (!$table->hasColumn('comment_detail')) {
$this->addSql("ALTER TABLE dtb_product ADD comment_detail TEXT DEFAULT NULL");
}
if (!$table->hasColumn('product_details_info')) {
$this->addSql("ALTER TABLE dtb_product ADD product_details_info TEXT DEFAULT NULL");
}
}
public function down(Schema $schema): void
{
// Remove column if exists
$table = $schema->getTable('dtb_product');
if ($table->hasColumn('product_details_info')) {
$this->addSql("ALTER TABLE dtb_product DROP COLUMN product_details_info");
}
if ($table->hasColumn('comment_detail')) {
$this->addSql("ALTER TABLE dtb_product DROP COLUMN comment_detail");
}
}
}