<?php
declare(strict_types=1);
namespace ProductsBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20240725134330 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE products_bundle__product_context ADD product_redirect_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', ADD category_redirect_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', ADD redirect_type VARCHAR(15) DEFAULT \'404\' NOT NULL');
$this->addSql('ALTER TABLE products_bundle__product_context ADD CONSTRAINT FK_F37E0B8C18021952 FOREIGN KEY (product_redirect_id) REFERENCES products_bundle__product (id)');
$this->addSql('ALTER TABLE products_bundle__product_context ADD CONSTRAINT FK_F37E0B8C3B6C526 FOREIGN KEY (category_redirect_id) REFERENCES categories_bundle__category (id)');
$this->addSql('CREATE INDEX IDX_F37E0B8C18021952 ON products_bundle__product_context (product_redirect_id)');
$this->addSql('CREATE INDEX IDX_F37E0B8C3B6C526 ON products_bundle__product_context (category_redirect_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE products_bundle__product_context DROP FOREIGN KEY FK_F37E0B8C18021952');
$this->addSql('ALTER TABLE products_bundle__product_context DROP FOREIGN KEY FK_F37E0B8C3B6C526');
$this->addSql('DROP INDEX IDX_F37E0B8C18021952 ON products_bundle__product_context');
$this->addSql('DROP INDEX IDX_F37E0B8C3B6C526 ON products_bundle__product_context');
$this->addSql('ALTER TABLE products_bundle__product_context DROP product_redirect_id, DROP category_redirect_id, DROP redirect_type');
}
}