<?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 Version20190718084116 extends AbstractMigration
{
    public function getDescription() : string
    {
        return '';
    }

    public function up(Schema $schema) : void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('CREATE TABLE robots_check (id INT AUTO_INCREMENT NOT NULL, campaign_id INT NOT NULL, value LONGTEXT DEFAULT NULL, exist TINYINT(1) NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_D4AE9532F639F774 (campaign_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
        $this->addSql('CREATE TABLE sitemap_check (id INT AUTO_INCREMENT NOT NULL, campaign_id INT NOT NULL, value LONGTEXT DEFAULT NULL, exist TINYINT(1) NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_9EF519C5F639F774 (campaign_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
        $this->addSql('ALTER TABLE robots_check ADD CONSTRAINT FK_D4AE9532F639F774 FOREIGN KEY (campaign_id) REFERENCES campaign (id) ON DELETE CASCADE');
        $this->addSql('ALTER TABLE sitemap_check ADD CONSTRAINT FK_9EF519C5F639F774 FOREIGN KEY (campaign_id) REFERENCES campaign (id) ON DELETE CASCADE');
        $this->addSql('ALTER TABLE campaign_keyword_check CHANGE google_ad_words_cpc google_ad_words_cpc DOUBLE PRECISION DEFAULT NULL, CHANGE monthly_searches monthly_searches INT DEFAULT NULL');
    }

    public function down(Schema $schema) : void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('DROP TABLE robots_check');
        $this->addSql('DROP TABLE sitemap_check');
        $this->addSql('ALTER TABLE campaign_keyword_check CHANGE google_ad_words_cpc google_ad_words_cpc DOUBLE PRECISION DEFAULT NULL, CHANGE monthly_searches monthly_searches INT DEFAULT NULL');
    }
}
