<?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 Version20240327112117 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
// set active subscriptions
$this->addSql("UPDATE users u SET latest_subscription_id = (
SELECT us.id FROM user_subscriptions us
WHERE us.user_id = u.id
AND us.end_subscription > UTC_TIMESTAMP()
ORDER BY us.id DESC LIMIT 1
)");
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
}
}