migrations/Version20220527132250.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 Version20220527132250 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Initial tables setup';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('CREATE TABLE command_last_run (id INT AUTO_INCREMENT NOT NULL, command_name VARCHAR(45) NOT NULL, last_run DATETIME NOT NULL, UNIQUE INDEX uk_command_last_run_command_name (command_name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE scans (id VARCHAR(32) NOT NULL, project_id VARCHAR(64) NOT NULL, capture_date DATETIME NOT NULL, landing_page_url VARCHAR(2048) DEFAULT NULL, landing_path LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\', more_info_link VARCHAR(2048) NOT NULL, screen_shot_url VARCHAR(2048) DEFAULT NULL, status INT NOT NULL, checksum VARCHAR(36) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX ix_scan_project_id (project_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE targets (id INT AUTO_INCREMENT NOT NULL, type_id INT NOT NULL, name VARCHAR(64) NOT NULL, project_id VARCHAR(64) DEFAULT NULL, internal_id VARCHAR(64) DEFAULT NULL, url VARCHAR(2048) NOT NULL, enabled TINYINT(1) DEFAULT 1 NOT NULL, valid_domains LONGTEXT NOT NULL COMMENT \'(DC2Type:simple_array)\', device_types LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:simple_array)\', countries LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:simple_array)\', operating_systems LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:simple_array)\', source_updated DATETIME DEFAULT NULL, last_sync DATETIME DEFAULT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX ix_target_type_id (type_id), INDEX ix_target_project_id (project_id), UNIQUE INDEX uk_target_name (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.     }
  22.     public function down(Schema $schema): void
  23.     {
  24.         // this down() migration is auto-generated, please modify it to your needs
  25.         $this->addSql('DROP TABLE command_last_run');
  26.         $this->addSql('DROP TABLE scans');
  27.         $this->addSql('DROP TABLE targets');
  28.     }
  29. }