<?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 Version20220901130925 extends AbstractMigration
{
public function getDescription(): string
{
return 'Adding version field to targets';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE targets ADD version INT NOT NULL');
$this->addSql('UPDATE targets SET version = UNIX_TIMESTAMP()');
$this->addSql('CREATE INDEX ix_target_version ON targets (version)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX ix_target_version ON targets');
$this->addSql('ALTER TABLE targets DROP version');
}
}