migrations/Version20250307164125.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20250307164125 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('ALTER TABLE customer_upsell_request ADD target_user_updated_at DATETIME DEFAULT NULL');
  19.         $this->addSql("
  20.             UPDATE customer_upsell_request AS upsell
  21.             SET target_user_updated_at = (
  22.                 SELECT created_at
  23.                 FROM customer_comment AS comment
  24.                 WHERE comment.upsell_request_id = upsell.id
  25.                 AND comment.body LIKE '% assigned this to %'
  26.                 ORDER BY comment.created_at DESC
  27.                 LIMIT 1
  28.             )
  29.             WHERE EXISTS (
  30.                 SELECT 1
  31.                 FROM customer_comment AS comment
  32.                 WHERE comment.upsell_request_id = upsell.id
  33.                 AND comment.body LIKE '% assigned this to %'
  34.             );
  35.         ");
  36.     }
  37.     public function down(Schema $schema): void
  38.     {
  39.         // this down() migration is auto-generated, please modify it to your needs
  40.         $this->addSql('ALTER TABLE customer_upsell_request DROP target_user_updated_at');
  41.     }
  42. }