<?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 Version20220117150839 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 product_domain (product_id INT NOT NULL, domain_id INT NOT NULL, INDEX IDX_C5D55FAF4584665A (product_id), INDEX IDX_C5D55FAF115F0EE5 (domain_id), PRIMARY KEY(product_id, domain_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE product_domain ADD CONSTRAINT FK_C5D55FAF4584665A FOREIGN KEY (product_id) REFERENCES product (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE product_domain ADD CONSTRAINT FK_C5D55FAF115F0EE5 FOREIGN KEY (domain_id) REFERENCES domain (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE product DROP FOREIGN KEY FK_D34A04AD115F0EE5');
$this->addSql('DROP INDEX IDX_D34A04AD115F0EE5 ON product');
$this->addSql('ALTER TABLE product DROP domain_id');
$this->addSql('ALTER TABLE product_variant ADD quantity INT DEFAULT NULL, ADD discount DOUBLE PRECISION DEFAULT NULL, ADD unit_price DOUBLE PRECISION DEFAULT NULL, ADD total_price DOUBLE PRECISION DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE product_domain');
$this->addSql('ALTER TABLE product ADD domain_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE product ADD CONSTRAINT FK_D34A04AD115F0EE5 FOREIGN KEY (domain_id) REFERENCES domain (id)');
$this->addSql('CREATE INDEX IDX_D34A04AD115F0EE5 ON product (domain_id)');
$this->addSql('ALTER TABLE product_variant DROP quantity, DROP discount, DROP unit_price, DROP total_price');
}
}