<?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 Version20190724135149 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('DROP TABLE google_analytics_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');
    }

    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('CREATE TABLE google_analytics_check (id INT AUTO_INCREMENT NOT NULL, campaign_id INT NOT NULL, google_analytics_drop_threshold INT NOT NULL, google_analytics_monitor_timeframe VARCHAR(255) NOT NULL COLLATE utf8mb4_unicode_ci, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_A4DD7937F639F774 (campaign_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB COMMENT = \'\' ');
        $this->addSql('ALTER TABLE google_analytics_check ADD CONSTRAINT FK_A4DD7937F639F774 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');
    }
}
