<?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 Version20190722150057 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 uptime_check (id INT AUTO_INCREMENT NOT NULL, campaign_id INT NOT NULL, value DOUBLE PRECISION NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_A3684761F639F774 (campaign_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
        $this->addSql('ALTER TABLE uptime_check ADD CONSTRAINT FK_A3684761F639F774 FOREIGN KEY (campaign_id) REFERENCES campaign (id)');
        $this->addSql('ALTER TABLE campaign ADD status_cake_id INT DEFAULT NULL');
        $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 uptime_check');
        $this->addSql('ALTER TABLE campaign DROP status_cake_id');
        $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');
    }
}
