<?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 Version20220824075906 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->addSql('CREATE TABLE email (id INT AUTO_INCREMENT NOT NULL, site_id INT DEFAULT NULL, sent TINYINT(1) DEFAULT NULL, sent_at DATETIME DEFAULT NULL, sent_report TINYINT(1) DEFAULT NULL, sent_report_at DATETIME DEFAULT NULL, template VARCHAR(100) NOT NULL, script_code VARCHAR(2000) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_E7927C74F6BD1646 (site_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE email_deal (email_id INT NOT NULL, deal_id INT NOT NULL, INDEX IDX_7CC8E193A832C1C9 (email_id), INDEX IDX_7CC8E193F60E2305 (deal_id), PRIMARY KEY(email_id, deal_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE email ADD CONSTRAINT FK_E7927C74F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id)');
$this->addSql('ALTER TABLE email_deal ADD CONSTRAINT FK_7CC8E193A832C1C9 FOREIGN KEY (email_id) REFERENCES email (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE email_deal ADD CONSTRAINT FK_7CC8E193F60E2305 FOREIGN KEY (deal_id) REFERENCES deal (id) ON DELETE CASCADE');
$this->addSql('DROP TABLE amazon_temp');
$this->addSql('DROP TABLE email_report');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE email_deal DROP FOREIGN KEY FK_7CC8E193A832C1C9');
$this->addSql('CREATE TABLE amazon_temp (id INT NOT NULL, price VARCHAR(100) CHARACTER SET latin1 NOT NULL COLLATE `latin1_swedish_ci`, price_new VARCHAR(100) CHARACTER SET latin1 NOT NULL COLLATE `latin1_swedish_ci`, link VARCHAR(1500) CHARACTER SET latin1 NOT NULL COLLATE `latin1_swedish_ci`, done INT DEFAULT 0 NOT NULL, changed DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, error VARCHAR(1000) CHARACTER SET latin1 NOT NULL COLLATE `latin1_swedish_ci`, message VARCHAR(255) CHARACTER SET latin1 NOT NULL COLLATE `latin1_swedish_ci`, avail VARCHAR(255) CHARACTER SET latin1 NOT NULL COLLATE `latin1_swedish_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET latin1 COLLATE `latin1_swedish_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE email_report (id INT AUTO_INCREMENT NOT NULL, site_id INT NOT NULL, email_id INT NOT NULL, parent_id INT NOT NULL, sort_id INT DEFAULT NULL, email_title VARCHAR(500) CHARACTER SET latin1 NOT NULL COLLATE `latin1_swedish_ci`, deal_id INT NOT NULL, deal_title VARCHAR(1000) CHARACTER SET latin1 NOT NULL COLLATE `latin1_swedish_ci`, price VARCHAR(100) CHARACTER SET latin1 DEFAULT NULL COLLATE `latin1_swedish_ci`, msrp VARCHAR(100) CHARACTER SET latin1 DEFAULT NULL COLLATE `latin1_swedish_ci`, link VARCHAR(1500) CHARACTER SET latin1 DEFAULT NULL COLLATE `latin1_swedish_ci`, merchant VARCHAR(255) CHARACTER SET latin1 DEFAULT NULL COLLATE `latin1_swedish_ci`, network VARCHAR(100) CHARACTER SET latin1 DEFAULT NULL COLLATE `latin1_swedish_ci`, sent_date VARCHAR(100) CHARACTER SET latin1 DEFAULT NULL COLLATE `latin1_swedish_ci`, clicks INT DEFAULT NULL, clickouts INT DEFAULT NULL, revenue NUMERIC(10, 2) DEFAULT NULL, commission NUMERIC(10, 2) DEFAULT NULL, src VARCHAR(500) CHARACTER SET latin1 DEFAULT NULL COLLATE `latin1_swedish_ci`, INDEX deal_title (deal_title), INDEX site_id (site_id), INDEX deal_id (deal_id), INDEX email_id (email_id), INDEX parent_id (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET latin1 COLLATE `latin1_swedish_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('DROP TABLE email');
$this->addSql('DROP TABLE email_deal');
}
}