<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use App\Entity\Admin\ModeInterface;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260517203741 extends AbstractMigration
{
public function getDescription(): string
{
return 'Updating values for shop settings to apply new rules for ASAP mode';
}
public function up(Schema $schema): void
{
$this->addSql(
sprintf(
"UPDATE shop_settings ss
JOIN shop_mode sm ON sm.shop_id = ss.shop_id
JOIN mode m ON m.id = sm.mode_id
SET
ss.future_orders = 0,
ss.pickup_mode = 0
WHERE
m.code = '%s'
AND sm.enabled = 1
AND sm.asap = 1
AND sm.deleted_at IS NULL
AND (
ss.future_orders = 1
OR ss.pickup_mode = 1
);",
ModeInterface::MODE_TAKEOUT
)
);
}
}