<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20260507230002 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Add device.next_poll_expected_at — server stamps it on every poll so the PWA shows the *real* next sync time, unaffected by locally-edited settings that the device has not yet picked up';
    }

    public function up(Schema $schema): void
    {
        $this->addSql('ALTER TABLE device ADD next_poll_expected_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
        $this->addSql("COMMENT ON COLUMN device.next_poll_expected_at IS '(DC2Type:datetime_immutable)'");
    }

    public function down(Schema $schema): void
    {
        $this->addSql('ALTER TABLE device DROP COLUMN next_poll_expected_at');
    }
}
