<?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 Version20241203141822 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 user ADD date_add DATETIME DEFAULT NULL');
$this->addSql('update `user` u inner join email e on e.user_id = u.id and e.template = "email/register.html.twig" set u.date_add = e.sent_at where e.user_id is not null;');
$this->addSql('UPDATE `user` u INNER JOIN (SELECT ustmp.user_id, MIN(ustmp.date_add) AS date_add FROM user_survey ustmp GROUP BY ustmp.user_id) AS us ON us.user_id = u.id SET u.date_add = us.date_add WHERE u.date_add IS NULL;');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE user DROP date_add');
}
}