<?php
declare(strict_types=1);
namespace ProductsBundleMigrations;
use DateTime;
use Doctrine\DBAL\Schema\Schema;
use App\Services\ObjectSerialize;
use Symfony\Component\Uid\UuidV6;
use Doctrine\Migrations\AbstractMigration;
final class Version20221118144208 extends AbstractMigration
{
private ObjectSerialize $objectSerialize;
public function setObjectSerialize(ObjectSerialize $objectSerialize)
{
$this->objectSerialize = $objectSerialize;
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE products_bundle__attribute (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', attribute_group_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(128) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_929927FF62D643B7 (attribute_group_id), INDEX IDX_929927FFB03A8386 (created_by_id), INDEX IDX_929927FF896DBBDE (updated_by_id), INDEX IDX_929927FFC76F1F52 (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__attribute_context (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', attribute_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_2BEB560CB6E62EFA (attribute_id), INDEX IDX_2BEB560C6B00C1CF (context_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_bundle__attribute_group (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(128) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_4E023231B03A8386 (created_by_id), INDEX IDX_4E023231896DBBDE (updated_by_id), INDEX IDX_4E023231C76F1F52 (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__attribute_group_context (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', attribute_group_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_4A85C4B862D643B7 (attribute_group_id), INDEX IDX_4A85C4B86B00C1CF (context_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_bundle__attribute_group_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_660EAACD232D562B (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('CREATE TABLE products_bundle__attribute_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_AAAF91FA232D562B (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('CREATE TABLE products_bundle__brand (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(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_E6FC9E69B03A8386 (created_by_id), INDEX IDX_E6FC9E69896DBBDE (updated_by_id), INDEX IDX_E6FC9E69C76F1F52 (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__brand_context (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', brand_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_238239EF44F5D008 (brand_id), INDEX IDX_238239EF6B00C1CF (context_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_bundle__declination (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', virtual_parent_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', unit_measure_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)\', reference VARCHAR(128) DEFAULT NULL, wholesale_price NUMERIC(20, 6) DEFAULT NULL, sell_price NUMERIC(20, 6) DEFAULT NULL, initial_unit NUMERIC(20, 6) DEFAULT NULL, weight NUMERIC(20, 6) DEFAULT NULL, virtual_quantity INT DEFAULT 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_CC8BB1204584665A (product_id), INDEX IDX_CC8BB12021C2B4E8 (virtual_parent_id), INDEX IDX_CC8BB1205E0BEBC0 (unit_measure_id), INDEX IDX_CC8BB120B03A8386 (created_by_id), INDEX IDX_CC8BB120896DBBDE (updated_by_id), INDEX IDX_CC8BB120C76F1F52 (deleted_by_id), INDEX reference (reference), INDEX wholesale_price (wholesale_price), INDEX sell_price (sell_price), INDEX initial_unit (initial_unit), INDEX weight (weight), 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 products_bundle__declination_attribute (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', declination_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', attribute_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_A248F59B9941A932 (declination_id), INDEX IDX_A248F59BB6E62EFA (attribute_id), INDEX IDX_A248F59BB03A8386 (created_by_id), INDEX IDX_A248F59B896DBBDE (updated_by_id), INDEX IDX_A248F59BC76F1F52 (deleted_by_id), 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__declination_context (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', declination_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_B1F3A3809941A932 (declination_id), INDEX IDX_B1F3A3806B00C1CF (context_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_bundle__ean13 (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', declination_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)\', value VARCHAR(13) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, is_default TINYINT(1) NOT NULL, INDEX IDX_D50078F94584665A (product_id), INDEX IDX_D50078F99941A932 (declination_id), INDEX IDX_D50078F9B03A8386 (created_by_id), INDEX IDX_D50078F9896DBBDE (updated_by_id), INDEX IDX_D50078F9C76F1F52 (deleted_by_id), INDEX value (value), INDEX is_default (is_default), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_bundle__eco_part (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', eco_part_group_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', currency_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(128) NOT NULL, reference VARCHAR(128) DEFAULT NULL, amount NUMERIC(20, 6) 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_52A691535F7690E5 (eco_part_group_id), INDEX IDX_52A6915338248176 (currency_id), INDEX IDX_52A69153B03A8386 (created_by_id), INDEX IDX_52A69153896DBBDE (updated_by_id), INDEX IDX_52A69153C76F1F52 (deleted_by_id), INDEX name (name), INDEX reference (reference), INDEX amount (amount), 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 products_bundle__eco_part_group (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(128) 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_86BC60A7B03A8386 (created_by_id), INDEX IDX_86BC60A7896DBBDE (updated_by_id), INDEX IDX_86BC60A7C76F1F52 (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 products_bundle__eco_part_group_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_6453299E232D562B (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('CREATE TABLE products_bundle__eco_part_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_7BFF0B9C232D562B (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('CREATE TABLE products_bundle__product (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_type_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', unit_measure_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', eco_part_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', tax_rule_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', brand_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', currency_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', parent_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)\', eco_part_amount NUMERIC(20, 6) DEFAULT NULL, name VARCHAR(255) NOT NULL, reference VARCHAR(255) DEFAULT NULL, reference_brand VARCHAR(255) DEFAULT NULL, summary LONGTEXT DEFAULT NULL, description LONGTEXT DEFAULT NULL, source VARCHAR(255) DEFAULT NULL, wholesale_price NUMERIC(20, 6) DEFAULT NULL, sell_price NUMERIC(20, 6) DEFAULT NULL, changeable_tax_rule TINYINT(1) NOT NULL, initial_unit NUMERIC(20, 6) DEFAULT NULL, weight NUMERIC(20, 6) DEFAULT NULL, width NUMERIC(20, 6) DEFAULT NULL, height NUMERIC(20, 6) DEFAULT NULL, depth NUMERIC(20, 6) DEFAULT NULL, customs_code VARCHAR(10) DEFAULT 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_C6C10D4A14959723 (product_type_id), INDEX IDX_C6C10D4A5E0BEBC0 (unit_measure_id), INDEX IDX_C6C10D4AAE870F68 (eco_part_id), INDEX IDX_C6C10D4A3506A35B (tax_rule_id), INDEX IDX_C6C10D4A44F5D008 (brand_id), INDEX IDX_C6C10D4A38248176 (currency_id), INDEX IDX_C6C10D4A727ACA70 (parent_id), INDEX IDX_C6C10D4AB03A8386 (created_by_id), INDEX IDX_C6C10D4A896DBBDE (updated_by_id), INDEX IDX_C6C10D4AC76F1F52 (deleted_by_id), INDEX reference (reference), INDEX reference_brand (reference_brand), INDEX name (name), INDEX wholesale_price (wholesale_price), INDEX sell_price (sell_price), 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 products_bundle__product_context (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_F37E0B8C4584665A (product_id), INDEX IDX_F37E0B8C6B00C1CF (context_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_bundle__product_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_9017C31B232D562B (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('CREATE TABLE products_bundle__product_type (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)\', number INT NOT NULL, name VARCHAR(40) 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_3C1F33B8B03A8386 (created_by_id), INDEX IDX_3C1F33B8896DBBDE (updated_by_id), INDEX IDX_3C1F33B8C76F1F52 (deleted_by_id), INDEX number (number), 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 products_bundle__product_type_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_4D8A1534232D562B (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('CREATE TABLE products_bundle__search_association (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', declination_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', search_word_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_A4AC80614584665A (product_id), INDEX IDX_A4AC80619941A932 (declination_id), INDEX IDX_A4AC80616E86AC17 (search_word_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products_bundle__search_word (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', word VARCHAR(32) NOT NULL, INDEX word (word), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE products_bundle__attribute ADD CONSTRAINT FK_929927FF62D643B7 FOREIGN KEY (attribute_group_id) REFERENCES products_bundle__attribute_group (id)');
$this->addSql('ALTER TABLE products_bundle__attribute ADD CONSTRAINT FK_929927FFB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__attribute ADD CONSTRAINT FK_929927FF896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__attribute ADD CONSTRAINT FK_929927FFC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__attribute_context ADD CONSTRAINT FK_2BEB560CB6E62EFA FOREIGN KEY (attribute_id) REFERENCES products_bundle__attribute (id)');
$this->addSql('ALTER TABLE products_bundle__attribute_context ADD CONSTRAINT FK_2BEB560C6B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE products_bundle__attribute_group ADD CONSTRAINT FK_4E023231B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__attribute_group ADD CONSTRAINT FK_4E023231896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__attribute_group ADD CONSTRAINT FK_4E023231C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__attribute_group_context ADD CONSTRAINT FK_4A85C4B862D643B7 FOREIGN KEY (attribute_group_id) REFERENCES products_bundle__attribute_group (id)');
$this->addSql('ALTER TABLE products_bundle__attribute_group_context ADD CONSTRAINT FK_4A85C4B86B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE products_bundle__attribute_group_translations ADD CONSTRAINT FK_660EAACD232D562B FOREIGN KEY (object_id) REFERENCES products_bundle__attribute_group (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE products_bundle__attribute_translations ADD CONSTRAINT FK_AAAF91FA232D562B FOREIGN KEY (object_id) REFERENCES products_bundle__attribute (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE products_bundle__brand ADD CONSTRAINT FK_E6FC9E69B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__brand ADD CONSTRAINT FK_E6FC9E69896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__brand ADD CONSTRAINT FK_E6FC9E69C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__brand_context ADD CONSTRAINT FK_238239EF44F5D008 FOREIGN KEY (brand_id) REFERENCES products_bundle__brand (id)');
$this->addSql('ALTER TABLE products_bundle__brand_context ADD CONSTRAINT FK_238239EF6B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE products_bundle__declination ADD CONSTRAINT FK_CC8BB1204584665A FOREIGN KEY (product_id) REFERENCES products_bundle__product (id)');
$this->addSql('ALTER TABLE products_bundle__declination ADD CONSTRAINT FK_CC8BB12021C2B4E8 FOREIGN KEY (virtual_parent_id) REFERENCES products_bundle__declination (id)');
$this->addSql('ALTER TABLE products_bundle__declination ADD CONSTRAINT FK_CC8BB1205E0BEBC0 FOREIGN KEY (unit_measure_id) REFERENCES unit_measure (id)');
$this->addSql('ALTER TABLE products_bundle__declination ADD CONSTRAINT FK_CC8BB120B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__declination ADD CONSTRAINT FK_CC8BB120896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__declination ADD CONSTRAINT FK_CC8BB120C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__declination_attribute ADD CONSTRAINT FK_A248F59B9941A932 FOREIGN KEY (declination_id) REFERENCES products_bundle__declination (id)');
$this->addSql('ALTER TABLE products_bundle__declination_attribute ADD CONSTRAINT FK_A248F59BB6E62EFA FOREIGN KEY (attribute_id) REFERENCES products_bundle__attribute (id)');
$this->addSql('ALTER TABLE products_bundle__declination_attribute ADD CONSTRAINT FK_A248F59BB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__declination_attribute ADD CONSTRAINT FK_A248F59B896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__declination_attribute ADD CONSTRAINT FK_A248F59BC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__declination_context ADD CONSTRAINT FK_B1F3A3809941A932 FOREIGN KEY (declination_id) REFERENCES products_bundle__declination (id)');
$this->addSql('ALTER TABLE products_bundle__declination_context ADD CONSTRAINT FK_B1F3A3806B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE products_bundle__ean13 ADD CONSTRAINT FK_D50078F94584665A FOREIGN KEY (product_id) REFERENCES products_bundle__product (id)');
$this->addSql('ALTER TABLE products_bundle__ean13 ADD CONSTRAINT FK_D50078F99941A932 FOREIGN KEY (declination_id) REFERENCES products_bundle__declination (id)');
$this->addSql('ALTER TABLE products_bundle__ean13 ADD CONSTRAINT FK_D50078F9B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__ean13 ADD CONSTRAINT FK_D50078F9896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__ean13 ADD CONSTRAINT FK_D50078F9C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__eco_part ADD CONSTRAINT FK_52A691535F7690E5 FOREIGN KEY (eco_part_group_id) REFERENCES products_bundle__eco_part_group (id)');
$this->addSql('ALTER TABLE products_bundle__eco_part ADD CONSTRAINT FK_52A6915338248176 FOREIGN KEY (currency_id) REFERENCES currency (id)');
$this->addSql('ALTER TABLE products_bundle__eco_part ADD CONSTRAINT FK_52A69153B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__eco_part ADD CONSTRAINT FK_52A69153896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__eco_part ADD CONSTRAINT FK_52A69153C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__eco_part_group ADD CONSTRAINT FK_86BC60A7B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__eco_part_group ADD CONSTRAINT FK_86BC60A7896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__eco_part_group ADD CONSTRAINT FK_86BC60A7C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__eco_part_group_translations ADD CONSTRAINT FK_6453299E232D562B FOREIGN KEY (object_id) REFERENCES products_bundle__eco_part_group (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE products_bundle__eco_part_translations ADD CONSTRAINT FK_7BFF0B9C232D562B FOREIGN KEY (object_id) REFERENCES products_bundle__eco_part (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE products_bundle__product ADD CONSTRAINT FK_C6C10D4A14959723 FOREIGN KEY (product_type_id) REFERENCES products_bundle__product_type (id)');
$this->addSql('ALTER TABLE products_bundle__product ADD CONSTRAINT FK_C6C10D4A5E0BEBC0 FOREIGN KEY (unit_measure_id) REFERENCES unit_measure (id)');
$this->addSql('ALTER TABLE products_bundle__product ADD CONSTRAINT FK_C6C10D4AAE870F68 FOREIGN KEY (eco_part_id) REFERENCES products_bundle__eco_part (id)');
$this->addSql('ALTER TABLE products_bundle__product ADD CONSTRAINT FK_C6C10D4A3506A35B FOREIGN KEY (tax_rule_id) REFERENCES tax_rule (id)');
$this->addSql('ALTER TABLE products_bundle__product ADD CONSTRAINT FK_C6C10D4A44F5D008 FOREIGN KEY (brand_id) REFERENCES products_bundle__brand (id)');
$this->addSql('ALTER TABLE products_bundle__product ADD CONSTRAINT FK_C6C10D4A38248176 FOREIGN KEY (currency_id) REFERENCES currency (id)');
$this->addSql('ALTER TABLE products_bundle__product ADD CONSTRAINT FK_C6C10D4A727ACA70 FOREIGN KEY (parent_id) REFERENCES products_bundle__product (id)');
$this->addSql('ALTER TABLE products_bundle__product ADD CONSTRAINT FK_C6C10D4AB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__product ADD CONSTRAINT FK_C6C10D4A896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__product ADD CONSTRAINT FK_C6C10D4AC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__product_context ADD CONSTRAINT FK_F37E0B8C4584665A FOREIGN KEY (product_id) REFERENCES products_bundle__product (id)');
$this->addSql('ALTER TABLE products_bundle__product_context ADD CONSTRAINT FK_F37E0B8C6B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE products_bundle__product_translations ADD CONSTRAINT FK_9017C31B232D562B FOREIGN KEY (object_id) REFERENCES products_bundle__product (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE products_bundle__product_type ADD CONSTRAINT FK_3C1F33B8B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__product_type ADD CONSTRAINT FK_3C1F33B8896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__product_type ADD CONSTRAINT FK_3C1F33B8C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE products_bundle__product_type_translations ADD CONSTRAINT FK_4D8A1534232D562B FOREIGN KEY (object_id) REFERENCES products_bundle__product_type (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE products_bundle__search_association ADD CONSTRAINT FK_A4AC80614584665A FOREIGN KEY (product_id) REFERENCES products_bundle__product (id)');
$this->addSql('ALTER TABLE products_bundle__search_association ADD CONSTRAINT FK_A4AC80619941A932 FOREIGN KEY (declination_id) REFERENCES products_bundle__declination (id)');
$this->addSql('ALTER TABLE products_bundle__search_association ADD CONSTRAINT FK_A4AC80616E86AC17 FOREIGN KEY (search_word_id) REFERENCES products_bundle__search_word (id)');
}
public function postUp(Schema $schema): void
{
parent::postUp($schema);
$languages = $this->connection->executeQuery('SELECT * FROM language WHERE deleted_at IS NULL')
->fetchAllAssociative();
$rootLocale = 'en';
$defaultLocale = $this->connection
->executeQuery('SELECT locale FROM language WHERE deleted_at IS NULL AND is_default = 1')
->fetchOne() ?: 'en';
$productTypes = [
['fr' => 'Produit', 'en' => 'Product', 'key' => 1],
['fr' => 'Service', 'en' => 'Service', 'key' => 2]
];
$this->connection->insert('configuration', [
'id' => (new UuidV6())->toBinary(),
'name' => 'products_bundle__shared_products',
'context_id' => null,
'value' => $this->objectSerialize->add((object) ['value' => '0']),
'created_at' => (new DateTime())->format('Y-m-d H:i:s'),
'updated_at' => (new DateTime())->format('Y-m-d H:i:s')
]);
foreach ($productTypes as $productType) {
$productTypeId = (new UuidV6())->toBinary();
$this->connection->insert('products_bundle__product_type', [
'id' => $productTypeId,
'name' => !empty($productType[$defaultLocale]) ?
$productType[$defaultLocale] : $productType[$rootLocale],
'number' => $productType['key'],
'is_active' => 1,
'created_at' => (new DateTime())->format('Y-m-d H:i:s'),
'updated_at' => (new DateTime())->format('Y-m-d H:i:s')
]);
foreach ($languages as $language) {
$localeTo = $rootLocale;
if (!empty($productType[$language['locale']])) {
$localeTo = $language['locale'];
} elseif (!empty($productType[$defaultLocale])) {
$localeTo = $defaultLocale;
}
$this->connection->insert('products_bundle__product_type_translations', [
'object_id' => $productTypeId,
'locale' => $language['locale'],
'field' => 'name',
'content' => $productType[$localeTo]
]);
}
}
}
public function down(Schema $schema): void
{
}
}