<?php
declare(strict_types=1);
namespace CoreMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230313205525 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('ALTER TABLE crm_bundle__opportunity_product ADD product_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE crm_bundle__opportunity_product ADD CONSTRAINT FK_C34790E34584665A FOREIGN KEY (product_id) REFERENCES products_bundle__product (id)');
$this->addSql('CREATE INDEX IDX_C34790E34584665A ON crm_bundle__opportunity_product (product_id)');
$this->addSql('ALTER TABLE product_returns_bundle__product_return_line CHANGE options options LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\'');
$this->addSql('ALTER TABLE products_bundle__attachment CHANGE options options LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\'');
$this->addSql('ALTER TABLE products_bundle__attribute CHANGE attribute_group_id attribute_group_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE products_bundle__price_rule ADD customer_group_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', ADD customer_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE products_bundle__price_rule ADD CONSTRAINT FK_3C8F79A7D2919A68 FOREIGN KEY (customer_group_id) REFERENCES customers_bundle__customer_group (id)');
$this->addSql('ALTER TABLE products_bundle__price_rule ADD CONSTRAINT FK_3C8F79A79395C3F3 FOREIGN KEY (customer_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('CREATE INDEX IDX_3C8F79A7D2919A68 ON products_bundle__price_rule (customer_group_id)');
$this->addSql('CREATE INDEX IDX_3C8F79A79395C3F3 ON products_bundle__price_rule (customer_id)');
$this->addSql('ALTER TABLE stocks_bundle__stock_movement ADD product_return_line_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE stocks_bundle__stock_movement ADD CONSTRAINT FK_11E6623A83A19B1 FOREIGN KEY (product_return_line_id) REFERENCES product_returns_bundle__product_return_line (id)');
$this->addSql('CREATE INDEX IDX_11E6623A83A19B1 ON stocks_bundle__stock_movement (product_return_line_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE products_bundle__price_rule DROP FOREIGN KEY FK_3C8F79A7D2919A68');
$this->addSql('ALTER TABLE products_bundle__price_rule DROP FOREIGN KEY FK_3C8F79A79395C3F3');
$this->addSql('DROP INDEX IDX_3C8F79A7D2919A68 ON products_bundle__price_rule');
$this->addSql('DROP INDEX IDX_3C8F79A79395C3F3 ON products_bundle__price_rule');
$this->addSql('ALTER TABLE products_bundle__price_rule DROP customer_group_id, DROP customer_id');
$this->addSql('ALTER TABLE crm_bundle__opportunity_product DROP FOREIGN KEY FK_C34790E34584665A');
$this->addSql('DROP INDEX IDX_C34790E34584665A ON crm_bundle__opportunity_product');
$this->addSql('ALTER TABLE crm_bundle__opportunity_product DROP product_id');
$this->addSql('ALTER TABLE products_bundle__attribute CHANGE attribute_group_id attribute_group_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE products_bundle__attachment CHANGE options options LONGTEXT NOT NULL COLLATE `utf8mb4_bin`');
$this->addSql('ALTER TABLE stocks_bundle__stock_movement DROP FOREIGN KEY FK_11E6623A83A19B1');
$this->addSql('DROP INDEX IDX_11E6623A83A19B1 ON stocks_bundle__stock_movement');
$this->addSql('ALTER TABLE stocks_bundle__stock_movement DROP product_return_line_id');
$this->addSql('ALTER TABLE product_returns_bundle__product_return_line CHANGE options options LONGTEXT DEFAULT NULL COLLATE `utf8mb4_bin`');
}
}