<?php
declare(strict_types=1);
namespace CategoriesBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20221206145914 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE categories_bundle__category (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', parent_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', root_id BINARY(16) DEFAULT 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(255) NOT NULL, description LONGTEXT DEFAULT NULL, lvl INT NOT NULL, lft INT NOT NULL, rgt INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, is_active TINYINT(1) DEFAULT 1 NOT NULL, INDEX IDX_5504FB5727ACA70 (parent_id), INDEX IDX_5504FB579066886 (root_id), INDEX IDX_5504FB5B03A8386 (created_by_id), INDEX IDX_5504FB5896DBBDE (updated_by_id), INDEX IDX_5504FB5C76F1F52 (deleted_by_id), INDEX name (name), INDEX is_active (is_active), 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 categories_bundle__category_context (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', category_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_7E2E3ED712469DE2 (category_id), INDEX IDX_7E2E3ED76B00C1CF (context_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE categories_bundle__category_product (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', category_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_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, is_default TINYINT(1) NOT NULL, INDEX IDX_4F39BF0412469DE2 (category_id), INDEX IDX_4F39BF044584665A (product_id), INDEX IDX_4F39BF04B03A8386 (created_by_id), INDEX IDX_4F39BF04896DBBDE (updated_by_id), INDEX IDX_4F39BF04C76F1F52 (deleted_by_id), INDEX is_default (is_default), 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 categories_bundle__category_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_FAB0FDE4232D562B (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 categories_bundle__category ADD CONSTRAINT FK_5504FB5727ACA70 FOREIGN KEY (parent_id) REFERENCES categories_bundle__category (id)');
$this->addSql('ALTER TABLE categories_bundle__category ADD CONSTRAINT FK_5504FB579066886 FOREIGN KEY (root_id) REFERENCES categories_bundle__category (id)');
$this->addSql('ALTER TABLE categories_bundle__category ADD CONSTRAINT FK_5504FB5B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE categories_bundle__category ADD CONSTRAINT FK_5504FB5896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE categories_bundle__category ADD CONSTRAINT FK_5504FB5C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE categories_bundle__category_context ADD CONSTRAINT FK_7E2E3ED712469DE2 FOREIGN KEY (category_id) REFERENCES categories_bundle__category (id)');
$this->addSql('ALTER TABLE categories_bundle__category_context ADD CONSTRAINT FK_7E2E3ED76B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE categories_bundle__category_product ADD CONSTRAINT FK_4F39BF0412469DE2 FOREIGN KEY (category_id) REFERENCES categories_bundle__category (id)');
$this->addSql('ALTER TABLE categories_bundle__category_product ADD CONSTRAINT FK_4F39BF044584665A FOREIGN KEY (product_id) REFERENCES products_bundle__product (id)');
$this->addSql('ALTER TABLE categories_bundle__category_product ADD CONSTRAINT FK_4F39BF04B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE categories_bundle__category_product ADD CONSTRAINT FK_4F39BF04896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE categories_bundle__category_product ADD CONSTRAINT FK_4F39BF04C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE categories_bundle__category_translations ADD CONSTRAINT FK_FAB0FDE4232D562B FOREIGN KEY (object_id) REFERENCES categories_bundle__category (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE categories_bundle__category DROP FOREIGN KEY FK_5504FB5727ACA70');
$this->addSql('ALTER TABLE categories_bundle__category DROP FOREIGN KEY FK_5504FB579066886');
$this->addSql('ALTER TABLE categories_bundle__category DROP FOREIGN KEY FK_5504FB5B03A8386');
$this->addSql('ALTER TABLE categories_bundle__category DROP FOREIGN KEY FK_5504FB5896DBBDE');
$this->addSql('ALTER TABLE categories_bundle__category DROP FOREIGN KEY FK_5504FB5C76F1F52');
$this->addSql('ALTER TABLE categories_bundle__category_context DROP FOREIGN KEY FK_7E2E3ED712469DE2');
$this->addSql('ALTER TABLE categories_bundle__category_context DROP FOREIGN KEY FK_7E2E3ED76B00C1CF');
$this->addSql('ALTER TABLE categories_bundle__category_product DROP FOREIGN KEY FK_4F39BF0412469DE2');
$this->addSql('ALTER TABLE categories_bundle__category_product DROP FOREIGN KEY FK_4F39BF044584665A');
$this->addSql('ALTER TABLE categories_bundle__category_product DROP FOREIGN KEY FK_4F39BF04B03A8386');
$this->addSql('ALTER TABLE categories_bundle__category_product DROP FOREIGN KEY FK_4F39BF04896DBBDE');
$this->addSql('ALTER TABLE categories_bundle__category_product DROP FOREIGN KEY FK_4F39BF04C76F1F52');
$this->addSql('ALTER TABLE categories_bundle__category_translations DROP FOREIGN KEY FK_FAB0FDE4232D562B');
$this->addSql('DROP TABLE categories_bundle__category');
$this->addSql('DROP TABLE categories_bundle__category_context');
$this->addSql('DROP TABLE categories_bundle__category_product');
$this->addSql('DROP TABLE categories_bundle__category_translations');
}
}