<?php
declare(strict_types=1);
namespace ProductsBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230117100607 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE products_bundle__product_feature (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_context_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', feature_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', feature_value_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', updated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', deleted_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_EF4FB94F8679EE4 (product_context_id), INDEX IDX_EF4FB9460E4B879 (feature_id), INDEX IDX_EF4FB9480CD149D (feature_value_id), INDEX IDX_EF4FB94B03A8386 (created_by_id), INDEX IDX_EF4FB94896DBBDE (updated_by_id), INDEX IDX_EF4FB94C76F1F52 (deleted_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE products_bundle__product_feature ADD CONSTRAINT FK_EF4FB94F8679EE4 FOREIGN KEY (product_context_id) REFERENCES products_bundle__product_context (id)');
$this->addSql('ALTER TABLE products_bundle__product_feature ADD CONSTRAINT FK_EF4FB9460E4B879 FOREIGN KEY (feature_id) REFERENCES products_bundle__feature (id)');
$this->addSql('ALTER TABLE products_bundle__product_feature ADD CONSTRAINT FK_EF4FB9480CD149D FOREIGN KEY (feature_value_id) REFERENCES products_bundle__feature_value (id)');
$this->addSql('ALTER TABLE products_bundle__product_feature ADD CONSTRAINT FK_EF4FB94B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__product_feature ADD CONSTRAINT FK_EF4FB94896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__product_feature ADD CONSTRAINT FK_EF4FB94C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__feature ADD hide_custom TINYINT(1) DEFAULT 1 NOT NULL');
$this->addSql('ALTER TABLE products_bundle__feature_value ADD is_custom TINYINT(1) DEFAULT 0 NOT NULL');
$this->addSql('CREATE INDEX is_custom ON products_bundle__feature_value (is_custom)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE products_bundle__product_feature DROP FOREIGN KEY FK_EF4FB94F8679EE4');
$this->addSql('ALTER TABLE products_bundle__product_feature DROP FOREIGN KEY FK_EF4FB9460E4B879');
$this->addSql('ALTER TABLE products_bundle__product_feature DROP FOREIGN KEY FK_EF4FB9480CD149D');
$this->addSql('ALTER TABLE products_bundle__product_feature DROP FOREIGN KEY FK_EF4FB94B03A8386');
$this->addSql('ALTER TABLE products_bundle__product_feature DROP FOREIGN KEY FK_EF4FB94896DBBDE');
$this->addSql('ALTER TABLE products_bundle__product_feature DROP FOREIGN KEY FK_EF4FB94C76F1F52');
$this->addSql('DROP TABLE products_bundle__product_feature');
$this->addSql('ALTER TABLE products_bundle__feature DROP hide_custom');
$this->addSql('DROP INDEX is_custom ON products_bundle__feature_value');
$this->addSql('ALTER TABLE products_bundle__feature_value DROP is_custom');
}
}