<?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 Version20190718123005 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 organic_overview_check (id INT AUTO_INCREMENT NOT NULL, campaign_id INT NOT NULL, total INT NOT NULL, visibility DOUBLE PRECISION NOT NULL, difference_visibility DOUBLE PRECISION NOT NULL, top100 INT NOT NULL, top100improved INT NOT NULL, top100declined INT NOT NULL, top100difference INT NOT NULL, top100left INT NOT NULL, top100entered INT NOT NULL, top3 INT NOT NULL, top3improved INT NOT NULL, top3declined INT NOT NULL, top3difference INT NOT NULL, top3left INT NOT NULL, top3entered INT NOT NULL, top10 INT NOT NULL, top10improved INT NOT NULL, top10declined INT NOT NULL, top10difference INT NOT NULL, top10left INT NOT NULL, top10entered INT NOT NULL, top20 INT NOT NULL, top20improved INT NOT NULL, top20declined INT NOT NULL, top20difference INT NOT NULL, top20left INT NOT NULL, top20entered INT NOT NULL, data LONGTEXT DEFAULT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_C5A833FCF639F774 (campaign_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
        $this->addSql('ALTER TABLE organic_overview_check ADD CONSTRAINT FK_C5A833FCF639F774 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 organic_overview_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');
    }
}
