<?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 Version20220119233700 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 products_languages (product_id INT NOT NULL, country_id INT NOT NULL, INDEX IDX_F2ACB05F4584665A (product_id), INDEX IDX_F2ACB05FF92F3E70 (country_id), PRIMARY KEY(product_id, country_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_countries (product_id INT NOT NULL, country_id INT NOT NULL, INDEX IDX_F1B088B4584665A (product_id), INDEX IDX_F1B088BF92F3E70 (country_id), PRIMARY KEY(product_id, country_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE products_languages ADD CONSTRAINT FK_F2ACB05F4584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('ALTER TABLE products_languages ADD CONSTRAINT FK_F2ACB05FF92F3E70 FOREIGN KEY (country_id) REFERENCES country (id)');
$this->addSql('ALTER TABLE products_countries ADD CONSTRAINT FK_F1B088B4584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('ALTER TABLE products_countries ADD CONSTRAINT FK_F1B088BF92F3E70 FOREIGN KEY (country_id) REFERENCES country (id)');
$this->addSql('ALTER TABLE product ADD main_product TINYINT(1) DEFAULT \'1\' NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE products_languages');
$this->addSql('DROP TABLE products_countries');
$this->addSql('ALTER TABLE product DROP main_product');
}
}