<?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 Version20211226142657 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 deal_category (deal_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_E5CB085BF60E2305 (deal_id), INDEX IDX_E5CB085B12469DE2 (category_id), PRIMARY KEY(deal_id, category_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE deal_site (deal_id INT NOT NULL, site_id INT NOT NULL, INDEX IDX_DF3E6C4BF60E2305 (deal_id), INDEX IDX_DF3E6C4BF6BD1646 (site_id), PRIMARY KEY(deal_id, site_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE deal_category ADD CONSTRAINT FK_E5CB085BF60E2305 FOREIGN KEY (deal_id) REFERENCES deal (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE deal_category ADD CONSTRAINT FK_E5CB085B12469DE2 FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE deal_site ADD CONSTRAINT FK_DF3E6C4BF60E2305 FOREIGN KEY (deal_id) REFERENCES deal (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE deal_site ADD CONSTRAINT FK_DF3E6C4BF6BD1646 FOREIGN KEY (site_id) REFERENCES site (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE deal ADD store_id INT DEFAULT NULL, ADD slug VARCHAR(200) NOT NULL, ADD price VARCHAR(100) DEFAULT NULL, ADD price_old VARCHAR(100) DEFAULT NULL, ADD price_additional VARCHAR(100) DEFAULT NULL, ADD merchant_revenue VARCHAR(100) DEFAULT NULL, ADD commission_earned VARCHAR(100) DEFAULT NULL, ADD description LONGTEXT DEFAULT NULL, ADD updates LONGTEXT DEFAULT NULL, ADD features_list LONGTEXT DEFAULT NULL, ADD details LONGTEXT DEFAULT NULL, ADD coupon VARCHAR(100) DEFAULT NULL, ADD link VARCHAR(255) NOT NULL, ADD sticky_from_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD sticky_to_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD newsletter_title VARCHAR(200) DEFAULT NULL, ADD remove_button TINYINT(1) DEFAULT NULL, ADD disabled_report_deal TINYINT(1) DEFAULT NULL, ADD exclude_top_deals TINYINT(1) DEFAULT NULL, ADD enable_direct_link_newsletter TINYINT(1) DEFAULT NULL, ADD sponsored TINYINT(1) DEFAULT NULL, ADD disabled_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD status VARCHAR(100) NOT NULL, ADD created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE deal ADD CONSTRAINT FK_E3FEC116B092A811 FOREIGN KEY (store_id) REFERENCES store (id)');
$this->addSql('CREATE INDEX IDX_E3FEC116B092A811 ON deal (store_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE deal_category');
$this->addSql('DROP TABLE deal_site');
$this->addSql('ALTER TABLE deal DROP FOREIGN KEY FK_E3FEC116B092A811');
$this->addSql('DROP INDEX IDX_E3FEC116B092A811 ON deal');
$this->addSql('ALTER TABLE deal DROP store_id, DROP slug, DROP price, DROP price_old, DROP price_additional, DROP merchant_revenue, DROP commission_earned, DROP description, DROP updates, DROP features_list, DROP details, DROP coupon, DROP link, DROP sticky_from_at, DROP sticky_to_at, DROP newsletter_title, DROP remove_button, DROP disabled_report_deal, DROP exclude_top_deals, DROP enable_direct_link_newsletter, DROP sponsored, DROP disabled_at, DROP status, DROP created_at, DROP updated_at');
}
}