<?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 Version20240102121234 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_products (products_source INT NOT NULL, products_target INT NOT NULL, INDEX IDX_A6BB4AE9D9B9F459 (products_source), INDEX IDX_A6BB4AE9C05CA4D6 (products_target), PRIMARY KEY(products_source, products_target)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE products_products ADD CONSTRAINT FK_A6BB4AE9D9B9F459 FOREIGN KEY (products_source) REFERENCES products (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE products_products ADD CONSTRAINT FK_A6BB4AE9C05CA4D6 FOREIGN KEY (products_target) REFERENCES products (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE products_products DROP FOREIGN KEY FK_A6BB4AE9D9B9F459');
$this->addSql('ALTER TABLE products_products DROP FOREIGN KEY FK_A6BB4AE9C05CA4D6');
$this->addSql('DROP TABLE products_products');
}
}