<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250114153207 extends AbstractMigration
{
public function getDescription(): string
{
return 'Replace "sending" with "pending" in the "events" field of the "webhook" table.';
}
public function up(Schema $schema): void
{
$this->addSql("
UPDATE webhook
SET events = JSON_ARRAY_APPEND(
JSON_REMOVE(events, JSON_UNQUOTE(JSON_SEARCH(events, 'one', 'sending'))),
'$', 'pending'
)
WHERE JSON_SEARCH(events, 'one', 'sending') IS NOT NULL
");
}
public function down(Schema $schema): void
{
$this->addSql("
UPDATE webhook
SET events = JSON_ARRAY_APPEND(
JSON_REMOVE(events, JSON_UNQUOTE(JSON_SEARCH(events, 'one', 'pending'))),
'$', 'sending'
)
WHERE JSON_SEARCH(events, 'one', 'pending') IS NOT NULL
");
}
}