<?php
declare(strict_types=1);
namespace ProductsBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Exception;
final class Version20231226083031 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE products_bundle__product ADD options JSON DEFAULT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE products_bundle__product DROP options');
}
public function postUp(Schema $schema): void
{
parent::postUp($schema);
try {
$query = "UPDATE `products_bundle__product` SET options = '[]'";
$conn = $this->connection->prepare($query);
$conn->executeQuery();
} catch (Exception $e) {
}
}
}