vendor/bluue/products-bundle/migrations/Version20231016113323.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace ProductsBundleMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. use Exception;
  7. final class Version20231016113323 extends AbstractMigration
  8. {
  9.     public function up(Schema $schema): void
  10.     {
  11.         $this->addSql('ALTER TABLE products_bundle__declination ADD options JSON NOT NULL');
  12.     }
  13.     public function down(Schema $schema): void
  14.     {
  15.         $this->addSql('ALTER TABLE products_bundle__declination DROP options');
  16.     }
  17.     public function postUp(Schema $schema): void
  18.     {
  19.         parent::postUp($schema);
  20.         try {
  21.             $conn $this->connection->prepare("UPDATE `products_bundle__declination` SET options = '[]'");
  22.             $conn->executeQuery();
  23.         } catch (Exception $e) {
  24.         }
  25.     }
  26. }