<?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 Version20250307164125 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE customer_upsell_request ADD target_user_updated_at DATETIME DEFAULT NULL');
$this->addSql("
UPDATE customer_upsell_request AS upsell
SET target_user_updated_at = (
SELECT created_at
FROM customer_comment AS comment
WHERE comment.upsell_request_id = upsell.id
AND comment.body LIKE '% assigned this to %'
ORDER BY comment.created_at DESC
LIMIT 1
)
WHERE EXISTS (
SELECT 1
FROM customer_comment AS comment
WHERE comment.upsell_request_id = upsell.id
AND comment.body LIKE '% assigned this to %'
);
");
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE customer_upsell_request DROP target_user_updated_at');
}
}