migrations/Version20240115210134.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20240115210134 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $this->addSql('INSERT INTO tag_scan (tag_type, scan_id) SELECT DISTINCT 1, s.id 
  18.                           FROM scans s, targets t WHERE s.target_id = t.id AND t.type_id IN (4, 5);');
  19.         $this->addSql('INSERT INTO tag_scan (tag_type, scan_id) SELECT DISTINCT 2, s.id 
  20.                           FROM scans s, targets t WHERE s.target_id = t.id AND t.type_id IN (0, 1, 2, 3);');
  21.         $this->addSql("INSERT INTO tag_scan (tag_type, scan_id) SELECT DISTINCT 3, s.id 
  22.                           FROM scans s, alerts a WHERE a.scan_id = s.id AND a.alert_id = 'ed3c9d15f8c7952f64d9675a4c66f750';");
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         $this->addSql('DELETE FROM tag_scan;');
  27.     }
  28. }