<?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 Version20220527132250 extends AbstractMigration
{
public function getDescription(): string
{
return 'Initial tables setup';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$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');
$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');
$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');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE command_last_run');
$this->addSql('DROP TABLE scans');
$this->addSql('DROP TABLE targets');
}
}