<?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 Version20220606172801 extends AbstractMigration
{
public function getDescription(): string
{
return 'Adding target id to scan results';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE scans ADD target_id INT NOT NULL AFTER id');
$this->addSql('ALTER TABLE scans ADD CONSTRAINT FK_2AA4F257158E0B66 FOREIGN KEY (target_id) REFERENCES targets (id)');
$this->addSql('CREATE INDEX ix_scan_target_id ON scans (target_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE scans DROP FOREIGN KEY FK_2AA4F257158E0B66');
$this->addSql('DROP INDEX ix_scan_target_id ON scans');
$this->addSql('ALTER TABLE scans DROP target_id');
}
}