<?php
declare(strict_types=1);
namespace ProductsBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20240222091957 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE products_bundle__product_tag (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', tag_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', is_active TINYINT(1) DEFAULT 1 NOT NULL, INDEX IDX_127504F9BAD26311 (tag_id), INDEX IDX_127504F94584665A (product_id), INDEX is_active (is_active), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_bundle__tag (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)\', name VARCHAR(30) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_8848D722B03A8386 (created_by_id), INDEX IDX_8848D722896DBBDE (updated_by_id), INDEX IDX_8848D722C76F1F52 (deleted_by_id), INDEX name (name), INDEX deleted_at (deleted_at), INDEX created_at (created_at), INDEX updated_at (updated_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_bundle__tag_translations (id INT AUTO_INCREMENT NOT NULL, object_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', locale VARCHAR(8) NOT NULL, field VARCHAR(32) NOT NULL, content LONGTEXT DEFAULT NULL, INDEX IDX_FEB32BAC232D562B (object_id), FULLTEXT INDEX content (content), UNIQUE INDEX lookup_unique_idx (locale, object_id, field), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE products_bundle__product_tag ADD CONSTRAINT FK_127504F9BAD26311 FOREIGN KEY (tag_id) REFERENCES products_bundle__tag (id)');
$this->addSql('ALTER TABLE products_bundle__product_tag ADD CONSTRAINT FK_127504F94584665A FOREIGN KEY (product_id) REFERENCES products_bundle__product (id)');
$this->addSql('ALTER TABLE products_bundle__tag ADD CONSTRAINT FK_8848D722B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__tag ADD CONSTRAINT FK_8848D722896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__tag ADD CONSTRAINT FK_8848D722C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__tag_translations ADD CONSTRAINT FK_FEB32BAC232D562B FOREIGN KEY (object_id) REFERENCES products_bundle__tag (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE products_bundle__product_tag DROP FOREIGN KEY FK_127504F9BAD26311');
$this->addSql('ALTER TABLE products_bundle__product_tag DROP FOREIGN KEY FK_127504F94584665A');
$this->addSql('ALTER TABLE products_bundle__tag DROP FOREIGN KEY FK_8848D722B03A8386');
$this->addSql('ALTER TABLE products_bundle__tag DROP FOREIGN KEY FK_8848D722896DBBDE');
$this->addSql('ALTER TABLE products_bundle__tag DROP FOREIGN KEY FK_8848D722C76F1F52');
$this->addSql('ALTER TABLE products_bundle__tag_translations DROP FOREIGN KEY FK_FEB32BAC232D562B');
$this->addSql('DROP TABLE products_bundle__product_tag');
$this->addSql('DROP TABLE products_bundle__tag');
$this->addSql('DROP TABLE products_bundle__tag_translations');
}
}