<?php
declare(strict_types=1);
namespace ShipmentsBundleMigrations;
use App\Services\ObjectSerialize;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Symfony\Component\Uid\UuidV6;
final class Version20240528120442 extends AbstractMigration
{
private ObjectSerialize $objectSerialize;
public function setObjectSerialize(ObjectSerialize $objectSerialize)
{
$this->objectSerialize = $objectSerialize;
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
}
public function postUp(Schema $schema): void
{
$now = (new \DateTime())->format('Y-m-d H:i:s');
$configuration = 'shipments_bundle__number_days_before_removal';
$this->connection->insert('configuration', [
'id' => (new UuidV6())->toBinary(),
'name' => $configuration,
'context_id' => null,
'value' => $this->objectSerialize->add((object) ['value' => 120]),
'created_at' => $now,
'updated_at' => $now
]);
$this->connection->insert('cron_job', [
'name' => 'shipments:auto-delete-label',
'command' => 'bluue-bundle:shipments:auto-delete-label',
'schedule' => '0 1 * * *',
'description' => '',
'enabled' => 1
]);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
}
}