<?php
declare(strict_types=1);
namespace SalesBundleMigrations;
use App\Services\ObjectSerialize;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Symfony\Component\Uid\UuidV6;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221206160121 extends AbstractMigration
{
private ObjectSerialize $objectSerialize;
public function setObjectSerialize(ObjectSerialize $objectSerialize)
{
$this->objectSerialize = $objectSerialize;
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE sales_bundle__additional_pdf (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', file_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)\', for_quotation TINYINT(1) NOT NULL, for_order TINYINT(1) NOT NULL, for_delivery_note TINYINT(1) NOT NULL, for_invoice TINYINT(1) NOT NULL, for_credit_note TINYINT(1) 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_3CDB90D193CB796C (file_id), INDEX IDX_3CDB90D1B03A8386 (created_by_id), INDEX IDX_3CDB90D1896DBBDE (updated_by_id), INDEX IDX_3CDB90D1C76F1F52 (deleted_by_id), INDEX for_quotation (for_quotation), INDEX for_order (for_order), INDEX for_delivery_note (for_delivery_note), INDEX for_invoice (for_invoice), INDEX for_credit_note (for_credit_note), 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 sales_bundle__bank (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, account_number VARCHAR(32) 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_82507772B03A8386 (created_by_id), INDEX IDX_82507772896DBBDE (updated_by_id), INDEX IDX_82507772C76F1F52 (deleted_by_id), INDEX name (name), INDEX account_number (account_number), 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 sales_bundle__credit_note (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', customer_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', invoice_address_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', delivery_address_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', invoice_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', currency_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', validated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', canceled_by_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)\', currency_change_rate NUMERIC(20, 12) NOT NULL, reference VARCHAR(128) DEFAULT NULL, internal_name VARCHAR(255) DEFAULT NULL, external_name VARCHAR(255) DEFAULT NULL, reduced_vat TINYINT(1) NOT NULL, total_amount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_tax_amount NUMERIC(20, 6) DEFAULT NULL, total_amount NUMERIC(20, 6) DEFAULT NULL, residual NUMERIC(20, 6) DEFAULT NULL, options JSON NOT NULL, validated_at DATETIME DEFAULT NULL, canceled_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_3BAC0D76B00C1CF (context_id), INDEX IDX_3BAC0D79395C3F3 (customer_id), INDEX IDX_3BAC0D7C6BDFEB (invoice_address_id), INDEX IDX_3BAC0D7EBF23851 (delivery_address_id), INDEX IDX_3BAC0D72989F1FD (invoice_id), INDEX IDX_3BAC0D738248176 (currency_id), INDEX IDX_3BAC0D7C69DE5E5 (validated_by_id), INDEX IDX_3BAC0D71418957 (canceled_by_id), INDEX IDX_3BAC0D7B03A8386 (created_by_id), INDEX IDX_3BAC0D7896DBBDE (updated_by_id), INDEX IDX_3BAC0D7C76F1F52 (deleted_by_id), INDEX internal_name (internal_name), INDEX reference (reference), INDEX total_amount_untaxed (total_amount_untaxed), INDEX total_amount (total_amount), INDEX validated_at (validated_at), INDEX canceled_at (canceled_at), 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 sales_bundle__credit_note_line (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', credit_note_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', line_type_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', tax_rule_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)\', is_group TINYINT(1) NOT NULL, reference VARCHAR(128) DEFAULT NULL, reference_brand VARCHAR(128) DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, unit_price NUMERIC(20, 6) DEFAULT NULL, quantity NUMERIC(20, 6) DEFAULT NULL, wholesale_price NUMERIC(20, 6) DEFAULT NULL, margin_ratio NUMERIC(20, 6) DEFAULT NULL, total_amount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_tax_amount NUMERIC(20, 6) DEFAULT NULL, total_amount NUMERIC(20, 6) DEFAULT NULL, position INT NOT NULL, options JSON NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_224DA1A71C696F7A (credit_note_id), INDEX IDX_224DA1A770E80DF4 (line_type_id), INDEX IDX_224DA1A73506A35B (tax_rule_id), INDEX IDX_224DA1A7727ACA70 (parent_id), INDEX IDX_224DA1A7B03A8386 (created_by_id), INDEX IDX_224DA1A7896DBBDE (updated_by_id), INDEX IDX_224DA1A7C76F1F52 (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 sales_bundle__customer_options (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', customer_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)\', for_quotation TINYINT(1) NOT NULL, for_order TINYINT(1) NOT NULL, for_delivery_note TINYINT(1) NOT NULL, for_invoice TINYINT(1) NOT NULL, for_credit_note TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_5E01AC229395C3F3 (customer_id), INDEX IDX_5E01AC22B03A8386 (created_by_id), INDEX IDX_5E01AC22896DBBDE (updated_by_id), INDEX IDX_5E01AC22C76F1F52 (deleted_by_id), INDEX for_quotation (for_quotation), INDEX for_order (for_order), INDEX for_delivery_note (for_delivery_note), INDEX for_invoice (for_invoice), INDEX for_credit_note (for_credit_note), 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 sales_bundle__delivery_note (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', customer_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', order_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', invoice_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', validated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', canceled_by_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, options JSON NOT NULL, validated_at DATETIME DEFAULT NULL, canceled_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_9CC42D76B00C1CF (context_id), INDEX IDX_9CC42D79395C3F3 (customer_id), INDEX IDX_9CC42D78D9F6D38 (order_id), UNIQUE INDEX UNIQ_9CC42D72989F1FD (invoice_id), INDEX IDX_9CC42D7C69DE5E5 (validated_by_id), INDEX IDX_9CC42D71418957 (canceled_by_id), INDEX IDX_9CC42D7B03A8386 (created_by_id), INDEX IDX_9CC42D7896DBBDE (updated_by_id), INDEX IDX_9CC42D7C76F1F52 (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 sales_bundle__delivery_note_line (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', delivery_note_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', order_line_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)\', quantity NUMERIC(20, 6) DEFAULT NULL, options JSON NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_CF8E237F2CF3B78B (delivery_note_id), INDEX IDX_CF8E237FBB01DC09 (order_line_id), INDEX IDX_CF8E237FB03A8386 (created_by_id), INDEX IDX_CF8E237F896DBBDE (updated_by_id), INDEX IDX_CF8E237FC76F1F52 (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 sales_bundle__document_payment (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', payment_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', invoice_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', credit_note_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)\', amount NUMERIC(20, 6) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_5BAED0CA4C3A3BB (payment_id), INDEX IDX_5BAED0CA2989F1FD (invoice_id), INDEX IDX_5BAED0CA1C696F7A (credit_note_id), INDEX IDX_5BAED0CAB03A8386 (created_by_id), INDEX IDX_5BAED0CA896DBBDE (updated_by_id), INDEX IDX_5BAED0CAC76F1F52 (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 sales_bundle__invoice (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', customer_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', invoice_address_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', delivery_address_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', quotation_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', order_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', credit_note_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', currency_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', payment_term_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', validated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', canceled_by_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)\', currency_change_rate NUMERIC(20, 12) NOT NULL, reference VARCHAR(128) DEFAULT NULL, internal_name VARCHAR(255) DEFAULT NULL, external_name VARCHAR(255) DEFAULT NULL, reduced_vat TINYINT(1) NOT NULL, total_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_amount_no_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_amount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_tax_amount NUMERIC(20, 6) DEFAULT NULL, total_amount NUMERIC(20, 6) DEFAULT NULL, residual NUMERIC(20, 6) DEFAULT NULL, due_date DATE DEFAULT NULL, is_deposit TINYINT(1) NOT NULL, options JSON NOT NULL, validated_at DATETIME DEFAULT NULL, canceled_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_BB8C2B4C6B00C1CF (context_id), INDEX IDX_BB8C2B4C9395C3F3 (customer_id), INDEX IDX_BB8C2B4CC6BDFEB (invoice_address_id), INDEX IDX_BB8C2B4CEBF23851 (delivery_address_id), INDEX IDX_BB8C2B4CB4EA4E60 (quotation_id), INDEX IDX_BB8C2B4C8D9F6D38 (order_id), INDEX IDX_BB8C2B4C1C696F7A (credit_note_id), INDEX IDX_BB8C2B4C38248176 (currency_id), INDEX IDX_BB8C2B4C17653B16 (payment_term_id), INDEX IDX_BB8C2B4CC69DE5E5 (validated_by_id), INDEX IDX_BB8C2B4C1418957 (canceled_by_id), INDEX IDX_BB8C2B4CB03A8386 (created_by_id), INDEX IDX_BB8C2B4C896DBBDE (updated_by_id), INDEX IDX_BB8C2B4CC76F1F52 (deleted_by_id), INDEX internal_name (internal_name), INDEX reference (reference), INDEX total_amount_untaxed (total_amount_untaxed), INDEX total_amount (total_amount), INDEX residual (residual), INDEX validated_at (validated_at), INDEX canceled_at (canceled_at), 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 sales_bundle__invoice_line (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', invoice_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', line_type_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', tax_rule_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)\', is_group TINYINT(1) NOT NULL, reference VARCHAR(128) DEFAULT NULL, reference_brand VARCHAR(128) DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, unit_price NUMERIC(20, 6) DEFAULT NULL, quantity NUMERIC(20, 6) DEFAULT NULL, wholesale_price NUMERIC(20, 6) DEFAULT NULL, margin_ratio NUMERIC(20, 6) DEFAULT NULL, percentage_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_amount_no_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_amount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_tax_amount NUMERIC(20, 6) DEFAULT NULL, total_amount NUMERIC(20, 6) DEFAULT NULL, position INT NOT NULL, options JSON NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_891FCC0D2989F1FD (invoice_id), INDEX IDX_891FCC0D70E80DF4 (line_type_id), INDEX IDX_891FCC0D3506A35B (tax_rule_id), INDEX IDX_891FCC0D727ACA70 (parent_id), INDEX IDX_891FCC0DB03A8386 (created_by_id), INDEX IDX_891FCC0D896DBBDE (updated_by_id), INDEX IDX_891FCC0DC76F1F52 (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 sales_bundle__line_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_E0257996B03A8386 (created_by_id), INDEX IDX_E0257996896DBBDE (updated_by_id), INDEX IDX_E0257996C76F1F52 (deleted_by_id), INDEX number (number), 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 sales_bundle__line_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_51AE71BF232D562B (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 sales_bundle__order (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', customer_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', invoice_address_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', delivery_address_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', quotation_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', order_state_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', currency_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', validated_by_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)\', currency_change_rate NUMERIC(20, 12) NOT NULL, reference VARCHAR(128) DEFAULT NULL, internal_name VARCHAR(255) DEFAULT NULL, external_name VARCHAR(255) DEFAULT NULL, reduced_vat TINYINT(1) NOT NULL, total_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_amount_no_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_amount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_tax_amount NUMERIC(20, 6) DEFAULT NULL, total_amount NUMERIC(20, 6) DEFAULT NULL, residual NUMERIC(20, 6) DEFAULT NULL, options JSON NOT NULL, validated_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_FBA82B626B00C1CF (context_id), INDEX IDX_FBA82B629395C3F3 (customer_id), INDEX IDX_FBA82B62C6BDFEB (invoice_address_id), INDEX IDX_FBA82B62EBF23851 (delivery_address_id), UNIQUE INDEX UNIQ_FBA82B62B4EA4E60 (quotation_id), INDEX IDX_FBA82B62E420DE70 (order_state_id), INDEX IDX_FBA82B6238248176 (currency_id), INDEX IDX_FBA82B62C69DE5E5 (validated_by_id), INDEX IDX_FBA82B62B03A8386 (created_by_id), INDEX IDX_FBA82B62896DBBDE (updated_by_id), INDEX IDX_FBA82B62C76F1F52 (deleted_by_id), INDEX internal_name (internal_name), INDEX reference (reference), INDEX total_amount_untaxed (total_amount_untaxed), INDEX total_amount (total_amount), INDEX residual (residual), 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 sales_bundle__order_history (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', order_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', order_state_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)\', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_C62DA9598D9F6D38 (order_id), INDEX IDX_C62DA959E420DE70 (order_state_id), INDEX IDX_C62DA959B03A8386 (created_by_id), INDEX IDX_C62DA959896DBBDE (updated_by_id), 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 sales_bundle__order_line (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', order_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', line_type_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', tax_rule_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)\', is_group TINYINT(1) NOT NULL, reference VARCHAR(128) DEFAULT NULL, reference_brand VARCHAR(128) DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, unit_price NUMERIC(20, 6) DEFAULT NULL, quantity NUMERIC(20, 6) DEFAULT NULL, quantity_delivered NUMERIC(20, 6) DEFAULT NULL, wholesale_price NUMERIC(20, 6) DEFAULT NULL, margin_ratio NUMERIC(20, 6) DEFAULT NULL, percentage_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_amount_no_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_amount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_tax_amount NUMERIC(20, 6) DEFAULT NULL, total_amount NUMERIC(20, 6) DEFAULT NULL, position INT NOT NULL, options JSON NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_38D3FC518D9F6D38 (order_id), INDEX IDX_38D3FC5170E80DF4 (line_type_id), INDEX IDX_38D3FC513506A35B (tax_rule_id), INDEX IDX_38D3FC51727ACA70 (parent_id), INDEX IDX_38D3FC51B03A8386 (created_by_id), INDEX IDX_38D3FC51896DBBDE (updated_by_id), INDEX IDX_38D3FC51C76F1F52 (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 sales_bundle__order_state (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, color VARCHAR(7) NOT NULL, text_color VARCHAR(7) NOT NULL, delivered TINYINT(1) NOT NULL, invoiced TINYINT(1) NOT NULL, canceled TINYINT(1) 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, is_default TINYINT(1) NOT NULL, archived TINYINT(1) NOT NULL, INDEX IDX_EBC823F8B03A8386 (created_by_id), INDEX IDX_EBC823F8896DBBDE (updated_by_id), INDEX IDX_EBC823F8C76F1F52 (deleted_by_id), INDEX color (color), INDEX text_color (text_color), INDEX name (name), INDEX delivered (delivered), INDEX invoiced (invoiced), INDEX archived (archived), INDEX is_active (is_active), 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 sales_bundle__order_state_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_67B6006B232D562B (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 sales_bundle__payment (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', customer_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', credit_note_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', invoice_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', payment_method_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', bank_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', currency_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)\', currency_change_rate NUMERIC(20, 12) NOT NULL, reference VARCHAR(128) DEFAULT NULL, receipt NUMERIC(20, 6) DEFAULT NULL, refund NUMERIC(20, 6) DEFAULT NULL, residual NUMERIC(20, 6) DEFAULT NULL, payment_date DATETIME NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_46C1B8056B00C1CF (context_id), INDEX IDX_46C1B8059395C3F3 (customer_id), INDEX IDX_46C1B8051C696F7A (credit_note_id), INDEX IDX_46C1B8052989F1FD (invoice_id), INDEX IDX_46C1B8055AA1164F (payment_method_id), INDEX IDX_46C1B80511C8FB41 (bank_id), INDEX IDX_46C1B80538248176 (currency_id), INDEX IDX_46C1B805B03A8386 (created_by_id), INDEX IDX_46C1B805896DBBDE (updated_by_id), INDEX IDX_46C1B805C76F1F52 (deleted_by_id), INDEX payment_date (payment_date), INDEX reference (reference), INDEX receipt (receipt), INDEX refund (refund), 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 sales_bundle__payment_method (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, is_invoice TINYINT(1) NOT NULL, is_credit_note TINYINT(1) 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_69C1A5D6B03A8386 (created_by_id), INDEX IDX_69C1A5D6896DBBDE (updated_by_id), INDEX IDX_69C1A5D6C76F1F52 (deleted_by_id), INDEX name (name), INDEX is_invoice (is_invoice), INDEX is_credit_note (is_credit_note), 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 sales_bundle__payment_method_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_38696A97232D562B (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 sales_bundle__payment_term (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, days_delay INT NOT NULL, end_month TINYINT(1) 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, is_default TINYINT(1) NOT NULL, INDEX IDX_DE426A67B03A8386 (created_by_id), INDEX IDX_DE426A67896DBBDE (updated_by_id), INDEX IDX_DE426A67C76F1F52 (deleted_by_id), INDEX name (name), INDEX days_delay (days_delay), INDEX end_month (end_month), INDEX is_active (is_active), 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 sales_bundle__payment_term_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_E2F5FF95232D562B (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 sales_bundle__quotation (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', customer_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', invoice_address_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', delivery_address_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', currency_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', payment_method_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', validated_by_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)\', currency_change_rate NUMERIC(20, 12) NOT NULL, validity_in_days INT DEFAULT NULL, reference VARCHAR(128) DEFAULT NULL, internal_name VARCHAR(255) DEFAULT NULL, external_name VARCHAR(255) DEFAULT NULL, reduced_vat TINYINT(1) NOT NULL, total_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_amount_no_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_amount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_tax_amount NUMERIC(20, 6) DEFAULT NULL, total_amount NUMERIC(20, 6) DEFAULT NULL, options JSON NOT NULL, validated_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, archived TINYINT(1) NOT NULL, INDEX IDX_A0FC50DF6B00C1CF (context_id), INDEX IDX_A0FC50DF9395C3F3 (customer_id), INDEX IDX_A0FC50DFC6BDFEB (invoice_address_id), INDEX IDX_A0FC50DFEBF23851 (delivery_address_id), INDEX IDX_A0FC50DF38248176 (currency_id), INDEX IDX_A0FC50DF5AA1164F (payment_method_id), INDEX IDX_A0FC50DFC69DE5E5 (validated_by_id), INDEX IDX_A0FC50DFB03A8386 (created_by_id), INDEX IDX_A0FC50DF896DBBDE (updated_by_id), INDEX IDX_A0FC50DFC76F1F52 (deleted_by_id), INDEX internal_name (internal_name), INDEX reference (reference), INDEX total_amount_untaxed (total_amount_untaxed), INDEX total_amount (total_amount), INDEX validated_at (validated_at), INDEX archived (archived), 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 sales_bundle__quotation_line (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', quotation_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', line_type_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', tax_rule_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)\', is_group TINYINT(1) NOT NULL, reference VARCHAR(128) DEFAULT NULL, reference_brand VARCHAR(128) DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, unit_price NUMERIC(20, 6) DEFAULT NULL, quantity NUMERIC(20, 6) DEFAULT NULL, wholesale_price NUMERIC(20, 6) DEFAULT NULL, margin_ratio NUMERIC(20, 6) DEFAULT NULL, percentage_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_amount_no_discount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_amount_untaxed NUMERIC(20, 6) DEFAULT NULL, total_tax_amount NUMERIC(20, 6) DEFAULT NULL, total_amount NUMERIC(20, 6) DEFAULT NULL, position INT NOT NULL, options JSON NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_5E40159AB4EA4E60 (quotation_id), INDEX IDX_5E40159A70E80DF4 (line_type_id), INDEX IDX_5E40159A3506A35B (tax_rule_id), INDEX IDX_5E40159A727ACA70 (parent_id), INDEX IDX_5E40159AB03A8386 (created_by_id), INDEX IDX_5E40159A896DBBDE (updated_by_id), INDEX IDX_5E40159AC76F1F52 (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('ALTER TABLE sales_bundle__additional_pdf ADD CONSTRAINT FK_3CDB90D193CB796C FOREIGN KEY (file_id) REFERENCES file_manager (id)');
$this->addSql('ALTER TABLE sales_bundle__additional_pdf ADD CONSTRAINT FK_3CDB90D1B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__additional_pdf ADD CONSTRAINT FK_3CDB90D1896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__additional_pdf ADD CONSTRAINT FK_3CDB90D1C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__bank ADD CONSTRAINT FK_82507772B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__bank ADD CONSTRAINT FK_82507772896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__bank ADD CONSTRAINT FK_82507772C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note ADD CONSTRAINT FK_3BAC0D76B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note ADD CONSTRAINT FK_3BAC0D79395C3F3 FOREIGN KEY (customer_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note ADD CONSTRAINT FK_3BAC0D7C6BDFEB FOREIGN KEY (invoice_address_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note ADD CONSTRAINT FK_3BAC0D7EBF23851 FOREIGN KEY (delivery_address_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note ADD CONSTRAINT FK_3BAC0D72989F1FD FOREIGN KEY (invoice_id) REFERENCES sales_bundle__invoice (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note ADD CONSTRAINT FK_3BAC0D738248176 FOREIGN KEY (currency_id) REFERENCES currency (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note ADD CONSTRAINT FK_3BAC0D7C69DE5E5 FOREIGN KEY (validated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note ADD CONSTRAINT FK_3BAC0D71418957 FOREIGN KEY (canceled_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note ADD CONSTRAINT FK_3BAC0D7B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note ADD CONSTRAINT FK_3BAC0D7896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note ADD CONSTRAINT FK_3BAC0D7C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line ADD CONSTRAINT FK_224DA1A71C696F7A FOREIGN KEY (credit_note_id) REFERENCES sales_bundle__credit_note (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line ADD CONSTRAINT FK_224DA1A770E80DF4 FOREIGN KEY (line_type_id) REFERENCES sales_bundle__line_type (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line ADD CONSTRAINT FK_224DA1A73506A35B FOREIGN KEY (tax_rule_id) REFERENCES tax_rule (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line ADD CONSTRAINT FK_224DA1A7727ACA70 FOREIGN KEY (parent_id) REFERENCES sales_bundle__credit_note_line (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line ADD CONSTRAINT FK_224DA1A7B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line ADD CONSTRAINT FK_224DA1A7896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line ADD CONSTRAINT FK_224DA1A7C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__customer_options ADD CONSTRAINT FK_5E01AC229395C3F3 FOREIGN KEY (customer_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__customer_options ADD CONSTRAINT FK_5E01AC22B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__customer_options ADD CONSTRAINT FK_5E01AC22896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__customer_options ADD CONSTRAINT FK_5E01AC22C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note ADD CONSTRAINT FK_9CC42D76B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note ADD CONSTRAINT FK_9CC42D79395C3F3 FOREIGN KEY (customer_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note ADD CONSTRAINT FK_9CC42D78D9F6D38 FOREIGN KEY (order_id) REFERENCES sales_bundle__order (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note ADD CONSTRAINT FK_9CC42D72989F1FD FOREIGN KEY (invoice_id) REFERENCES sales_bundle__invoice (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note ADD CONSTRAINT FK_9CC42D7C69DE5E5 FOREIGN KEY (validated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note ADD CONSTRAINT FK_9CC42D71418957 FOREIGN KEY (canceled_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note ADD CONSTRAINT FK_9CC42D7B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note ADD CONSTRAINT FK_9CC42D7896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note ADD CONSTRAINT FK_9CC42D7C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note_line ADD CONSTRAINT FK_CF8E237F2CF3B78B FOREIGN KEY (delivery_note_id) REFERENCES sales_bundle__delivery_note (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note_line ADD CONSTRAINT FK_CF8E237FBB01DC09 FOREIGN KEY (order_line_id) REFERENCES sales_bundle__order_line (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note_line ADD CONSTRAINT FK_CF8E237FB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note_line ADD CONSTRAINT FK_CF8E237F896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__delivery_note_line ADD CONSTRAINT FK_CF8E237FC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__document_payment ADD CONSTRAINT FK_5BAED0CA4C3A3BB FOREIGN KEY (payment_id) REFERENCES sales_bundle__payment (id)');
$this->addSql('ALTER TABLE sales_bundle__document_payment ADD CONSTRAINT FK_5BAED0CA2989F1FD FOREIGN KEY (invoice_id) REFERENCES sales_bundle__invoice (id)');
$this->addSql('ALTER TABLE sales_bundle__document_payment ADD CONSTRAINT FK_5BAED0CA1C696F7A FOREIGN KEY (credit_note_id) REFERENCES sales_bundle__credit_note (id)');
$this->addSql('ALTER TABLE sales_bundle__document_payment ADD CONSTRAINT FK_5BAED0CAB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__document_payment ADD CONSTRAINT FK_5BAED0CA896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__document_payment ADD CONSTRAINT FK_5BAED0CAC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4C6B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4C9395C3F3 FOREIGN KEY (customer_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4CC6BDFEB FOREIGN KEY (invoice_address_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4CEBF23851 FOREIGN KEY (delivery_address_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4CB4EA4E60 FOREIGN KEY (quotation_id) REFERENCES sales_bundle__quotation (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4C8D9F6D38 FOREIGN KEY (order_id) REFERENCES sales_bundle__order (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4C1C696F7A FOREIGN KEY (credit_note_id) REFERENCES sales_bundle__credit_note (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4C38248176 FOREIGN KEY (currency_id) REFERENCES currency (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4C17653B16 FOREIGN KEY (payment_term_id) REFERENCES sales_bundle__payment_term (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4CC69DE5E5 FOREIGN KEY (validated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4C1418957 FOREIGN KEY (canceled_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4CB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4C896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice ADD CONSTRAINT FK_BB8C2B4CC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice_line ADD CONSTRAINT FK_891FCC0D2989F1FD FOREIGN KEY (invoice_id) REFERENCES sales_bundle__invoice (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice_line ADD CONSTRAINT FK_891FCC0D70E80DF4 FOREIGN KEY (line_type_id) REFERENCES sales_bundle__line_type (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice_line ADD CONSTRAINT FK_891FCC0D3506A35B FOREIGN KEY (tax_rule_id) REFERENCES tax_rule (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice_line ADD CONSTRAINT FK_891FCC0D727ACA70 FOREIGN KEY (parent_id) REFERENCES sales_bundle__invoice_line (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice_line ADD CONSTRAINT FK_891FCC0DB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice_line ADD CONSTRAINT FK_891FCC0D896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__invoice_line ADD CONSTRAINT FK_891FCC0DC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__line_type ADD CONSTRAINT FK_E0257996B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__line_type ADD CONSTRAINT FK_E0257996896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__line_type ADD CONSTRAINT FK_E0257996C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__line_type_translations ADD CONSTRAINT FK_51AE71BF232D562B FOREIGN KEY (object_id) REFERENCES sales_bundle__line_type (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE sales_bundle__order ADD CONSTRAINT FK_FBA82B626B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE sales_bundle__order ADD CONSTRAINT FK_FBA82B629395C3F3 FOREIGN KEY (customer_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__order ADD CONSTRAINT FK_FBA82B62C6BDFEB FOREIGN KEY (invoice_address_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__order ADD CONSTRAINT FK_FBA82B62EBF23851 FOREIGN KEY (delivery_address_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__order ADD CONSTRAINT FK_FBA82B62B4EA4E60 FOREIGN KEY (quotation_id) REFERENCES sales_bundle__quotation (id)');
$this->addSql('ALTER TABLE sales_bundle__order ADD CONSTRAINT FK_FBA82B62E420DE70 FOREIGN KEY (order_state_id) REFERENCES sales_bundle__order_state (id)');
$this->addSql('ALTER TABLE sales_bundle__order ADD CONSTRAINT FK_FBA82B6238248176 FOREIGN KEY (currency_id) REFERENCES currency (id)');
$this->addSql('ALTER TABLE sales_bundle__order ADD CONSTRAINT FK_FBA82B62C69DE5E5 FOREIGN KEY (validated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__order ADD CONSTRAINT FK_FBA82B62B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__order ADD CONSTRAINT FK_FBA82B62896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__order ADD CONSTRAINT FK_FBA82B62C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__order_history ADD CONSTRAINT FK_C62DA9598D9F6D38 FOREIGN KEY (order_id) REFERENCES sales_bundle__order (id)');
$this->addSql('ALTER TABLE sales_bundle__order_history ADD CONSTRAINT FK_C62DA959E420DE70 FOREIGN KEY (order_state_id) REFERENCES sales_bundle__order_state (id)');
$this->addSql('ALTER TABLE sales_bundle__order_history ADD CONSTRAINT FK_C62DA959B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__order_history ADD CONSTRAINT FK_C62DA959896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__order_line ADD CONSTRAINT FK_38D3FC518D9F6D38 FOREIGN KEY (order_id) REFERENCES sales_bundle__order (id)');
$this->addSql('ALTER TABLE sales_bundle__order_line ADD CONSTRAINT FK_38D3FC5170E80DF4 FOREIGN KEY (line_type_id) REFERENCES sales_bundle__line_type (id)');
$this->addSql('ALTER TABLE sales_bundle__order_line ADD CONSTRAINT FK_38D3FC513506A35B FOREIGN KEY (tax_rule_id) REFERENCES tax_rule (id)');
$this->addSql('ALTER TABLE sales_bundle__order_line ADD CONSTRAINT FK_38D3FC51727ACA70 FOREIGN KEY (parent_id) REFERENCES sales_bundle__order_line (id)');
$this->addSql('ALTER TABLE sales_bundle__order_line ADD CONSTRAINT FK_38D3FC51B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__order_line ADD CONSTRAINT FK_38D3FC51896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__order_line ADD CONSTRAINT FK_38D3FC51C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__order_state ADD CONSTRAINT FK_EBC823F8B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__order_state ADD CONSTRAINT FK_EBC823F8896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__order_state ADD CONSTRAINT FK_EBC823F8C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__order_state_translations ADD CONSTRAINT FK_67B6006B232D562B FOREIGN KEY (object_id) REFERENCES sales_bundle__order_state (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE sales_bundle__payment ADD CONSTRAINT FK_46C1B8056B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE sales_bundle__payment ADD CONSTRAINT FK_46C1B8059395C3F3 FOREIGN KEY (customer_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__payment ADD CONSTRAINT FK_46C1B8051C696F7A FOREIGN KEY (credit_note_id) REFERENCES sales_bundle__credit_note (id)');
$this->addSql('ALTER TABLE sales_bundle__payment ADD CONSTRAINT FK_46C1B8052989F1FD FOREIGN KEY (invoice_id) REFERENCES sales_bundle__invoice (id)');
$this->addSql('ALTER TABLE sales_bundle__payment ADD CONSTRAINT FK_46C1B8055AA1164F FOREIGN KEY (payment_method_id) REFERENCES sales_bundle__payment_method (id)');
$this->addSql('ALTER TABLE sales_bundle__payment ADD CONSTRAINT FK_46C1B80511C8FB41 FOREIGN KEY (bank_id) REFERENCES sales_bundle__bank (id)');
$this->addSql('ALTER TABLE sales_bundle__payment ADD CONSTRAINT FK_46C1B80538248176 FOREIGN KEY (currency_id) REFERENCES currency (id)');
$this->addSql('ALTER TABLE sales_bundle__payment ADD CONSTRAINT FK_46C1B805B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__payment ADD CONSTRAINT FK_46C1B805896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__payment ADD CONSTRAINT FK_46C1B805C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__payment_method ADD CONSTRAINT FK_69C1A5D6B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__payment_method ADD CONSTRAINT FK_69C1A5D6896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__payment_method ADD CONSTRAINT FK_69C1A5D6C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__payment_method_translations ADD CONSTRAINT FK_38696A97232D562B FOREIGN KEY (object_id) REFERENCES sales_bundle__payment_method (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE sales_bundle__payment_term ADD CONSTRAINT FK_DE426A67B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__payment_term ADD CONSTRAINT FK_DE426A67896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__payment_term ADD CONSTRAINT FK_DE426A67C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__payment_term_translations ADD CONSTRAINT FK_E2F5FF95232D562B FOREIGN KEY (object_id) REFERENCES sales_bundle__payment_term (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE sales_bundle__quotation ADD CONSTRAINT FK_A0FC50DF6B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation ADD CONSTRAINT FK_A0FC50DF9395C3F3 FOREIGN KEY (customer_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation ADD CONSTRAINT FK_A0FC50DFC6BDFEB FOREIGN KEY (invoice_address_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation ADD CONSTRAINT FK_A0FC50DFEBF23851 FOREIGN KEY (delivery_address_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation ADD CONSTRAINT FK_A0FC50DF38248176 FOREIGN KEY (currency_id) REFERENCES currency (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation ADD CONSTRAINT FK_A0FC50DF5AA1164F FOREIGN KEY (payment_method_id) REFERENCES sales_bundle__payment_method (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation ADD CONSTRAINT FK_A0FC50DFC69DE5E5 FOREIGN KEY (validated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation ADD CONSTRAINT FK_A0FC50DFB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation ADD CONSTRAINT FK_A0FC50DF896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation ADD CONSTRAINT FK_A0FC50DFC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation_line ADD CONSTRAINT FK_5E40159AB4EA4E60 FOREIGN KEY (quotation_id) REFERENCES sales_bundle__quotation (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation_line ADD CONSTRAINT FK_5E40159A70E80DF4 FOREIGN KEY (line_type_id) REFERENCES sales_bundle__line_type (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation_line ADD CONSTRAINT FK_5E40159A3506A35B FOREIGN KEY (tax_rule_id) REFERENCES tax_rule (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation_line ADD CONSTRAINT FK_5E40159A727ACA70 FOREIGN KEY (parent_id) REFERENCES sales_bundle__quotation_line (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation_line ADD CONSTRAINT FK_5E40159AB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation_line ADD CONSTRAINT FK_5E40159A896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sales_bundle__quotation_line ADD CONSTRAINT FK_5E40159AC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE sales_bundle__additional_pdf DROP FOREIGN KEY FK_3CDB90D193CB796C');
$this->addSql('ALTER TABLE sales_bundle__additional_pdf DROP FOREIGN KEY FK_3CDB90D1B03A8386');
$this->addSql('ALTER TABLE sales_bundle__additional_pdf DROP FOREIGN KEY FK_3CDB90D1896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__additional_pdf DROP FOREIGN KEY FK_3CDB90D1C76F1F52');
$this->addSql('ALTER TABLE sales_bundle__bank DROP FOREIGN KEY FK_82507772B03A8386');
$this->addSql('ALTER TABLE sales_bundle__bank DROP FOREIGN KEY FK_82507772896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__bank DROP FOREIGN KEY FK_82507772C76F1F52');
$this->addSql('ALTER TABLE sales_bundle__credit_note DROP FOREIGN KEY FK_3BAC0D76B00C1CF');
$this->addSql('ALTER TABLE sales_bundle__credit_note DROP FOREIGN KEY FK_3BAC0D79395C3F3');
$this->addSql('ALTER TABLE sales_bundle__credit_note DROP FOREIGN KEY FK_3BAC0D7C6BDFEB');
$this->addSql('ALTER TABLE sales_bundle__credit_note DROP FOREIGN KEY FK_3BAC0D7EBF23851');
$this->addSql('ALTER TABLE sales_bundle__credit_note DROP FOREIGN KEY FK_3BAC0D72989F1FD');
$this->addSql('ALTER TABLE sales_bundle__credit_note DROP FOREIGN KEY FK_3BAC0D738248176');
$this->addSql('ALTER TABLE sales_bundle__credit_note DROP FOREIGN KEY FK_3BAC0D7C69DE5E5');
$this->addSql('ALTER TABLE sales_bundle__credit_note DROP FOREIGN KEY FK_3BAC0D71418957');
$this->addSql('ALTER TABLE sales_bundle__credit_note DROP FOREIGN KEY FK_3BAC0D7B03A8386');
$this->addSql('ALTER TABLE sales_bundle__credit_note DROP FOREIGN KEY FK_3BAC0D7896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__credit_note DROP FOREIGN KEY FK_3BAC0D7C76F1F52');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line DROP FOREIGN KEY FK_224DA1A71C696F7A');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line DROP FOREIGN KEY FK_224DA1A770E80DF4');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line DROP FOREIGN KEY FK_224DA1A73506A35B');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line DROP FOREIGN KEY FK_224DA1A7727ACA70');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line DROP FOREIGN KEY FK_224DA1A7B03A8386');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line DROP FOREIGN KEY FK_224DA1A7896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__credit_note_line DROP FOREIGN KEY FK_224DA1A7C76F1F52');
$this->addSql('ALTER TABLE sales_bundle__customer_options DROP FOREIGN KEY FK_5E01AC229395C3F3');
$this->addSql('ALTER TABLE sales_bundle__customer_options DROP FOREIGN KEY FK_5E01AC22B03A8386');
$this->addSql('ALTER TABLE sales_bundle__customer_options DROP FOREIGN KEY FK_5E01AC22896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__customer_options DROP FOREIGN KEY FK_5E01AC22C76F1F52');
$this->addSql('ALTER TABLE sales_bundle__delivery_note DROP FOREIGN KEY FK_9CC42D76B00C1CF');
$this->addSql('ALTER TABLE sales_bundle__delivery_note DROP FOREIGN KEY FK_9CC42D79395C3F3');
$this->addSql('ALTER TABLE sales_bundle__delivery_note DROP FOREIGN KEY FK_9CC42D78D9F6D38');
$this->addSql('ALTER TABLE sales_bundle__delivery_note DROP FOREIGN KEY FK_9CC42D72989F1FD');
$this->addSql('ALTER TABLE sales_bundle__delivery_note DROP FOREIGN KEY FK_9CC42D7C69DE5E5');
$this->addSql('ALTER TABLE sales_bundle__delivery_note DROP FOREIGN KEY FK_9CC42D71418957');
$this->addSql('ALTER TABLE sales_bundle__delivery_note DROP FOREIGN KEY FK_9CC42D7B03A8386');
$this->addSql('ALTER TABLE sales_bundle__delivery_note DROP FOREIGN KEY FK_9CC42D7896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__delivery_note DROP FOREIGN KEY FK_9CC42D7C76F1F52');
$this->addSql('ALTER TABLE sales_bundle__delivery_note_line DROP FOREIGN KEY FK_CF8E237F2CF3B78B');
$this->addSql('ALTER TABLE sales_bundle__delivery_note_line DROP FOREIGN KEY FK_CF8E237FBB01DC09');
$this->addSql('ALTER TABLE sales_bundle__delivery_note_line DROP FOREIGN KEY FK_CF8E237FB03A8386');
$this->addSql('ALTER TABLE sales_bundle__delivery_note_line DROP FOREIGN KEY FK_CF8E237F896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__delivery_note_line DROP FOREIGN KEY FK_CF8E237FC76F1F52');
$this->addSql('ALTER TABLE sales_bundle__document_payment DROP FOREIGN KEY FK_5BAED0CA4C3A3BB');
$this->addSql('ALTER TABLE sales_bundle__document_payment DROP FOREIGN KEY FK_5BAED0CA2989F1FD');
$this->addSql('ALTER TABLE sales_bundle__document_payment DROP FOREIGN KEY FK_5BAED0CA1C696F7A');
$this->addSql('ALTER TABLE sales_bundle__document_payment DROP FOREIGN KEY FK_5BAED0CAB03A8386');
$this->addSql('ALTER TABLE sales_bundle__document_payment DROP FOREIGN KEY FK_5BAED0CA896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__document_payment DROP FOREIGN KEY FK_5BAED0CAC76F1F52');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4C6B00C1CF');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4C9395C3F3');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4CC6BDFEB');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4CEBF23851');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4CB4EA4E60');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4C8D9F6D38');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4C1C696F7A');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4C38248176');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4C17653B16');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4CC69DE5E5');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4C1418957');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4CB03A8386');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4C896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__invoice DROP FOREIGN KEY FK_BB8C2B4CC76F1F52');
$this->addSql('ALTER TABLE sales_bundle__invoice_line DROP FOREIGN KEY FK_891FCC0D2989F1FD');
$this->addSql('ALTER TABLE sales_bundle__invoice_line DROP FOREIGN KEY FK_891FCC0D70E80DF4');
$this->addSql('ALTER TABLE sales_bundle__invoice_line DROP FOREIGN KEY FK_891FCC0D3506A35B');
$this->addSql('ALTER TABLE sales_bundle__invoice_line DROP FOREIGN KEY FK_891FCC0D727ACA70');
$this->addSql('ALTER TABLE sales_bundle__invoice_line DROP FOREIGN KEY FK_891FCC0DB03A8386');
$this->addSql('ALTER TABLE sales_bundle__invoice_line DROP FOREIGN KEY FK_891FCC0D896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__invoice_line DROP FOREIGN KEY FK_891FCC0DC76F1F52');
$this->addSql('ALTER TABLE sales_bundle__line_type DROP FOREIGN KEY FK_E0257996B03A8386');
$this->addSql('ALTER TABLE sales_bundle__line_type DROP FOREIGN KEY FK_E0257996896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__line_type DROP FOREIGN KEY FK_E0257996C76F1F52');
$this->addSql('ALTER TABLE sales_bundle__line_type_translations DROP FOREIGN KEY FK_51AE71BF232D562B');
$this->addSql('ALTER TABLE sales_bundle__order DROP FOREIGN KEY FK_FBA82B626B00C1CF');
$this->addSql('ALTER TABLE sales_bundle__order DROP FOREIGN KEY FK_FBA82B629395C3F3');
$this->addSql('ALTER TABLE sales_bundle__order DROP FOREIGN KEY FK_FBA82B62C6BDFEB');
$this->addSql('ALTER TABLE sales_bundle__order DROP FOREIGN KEY FK_FBA82B62EBF23851');
$this->addSql('ALTER TABLE sales_bundle__order DROP FOREIGN KEY FK_FBA82B62B4EA4E60');
$this->addSql('ALTER TABLE sales_bundle__order DROP FOREIGN KEY FK_FBA82B62E420DE70');
$this->addSql('ALTER TABLE sales_bundle__order DROP FOREIGN KEY FK_FBA82B6238248176');
$this->addSql('ALTER TABLE sales_bundle__order DROP FOREIGN KEY FK_FBA82B62C69DE5E5');
$this->addSql('ALTER TABLE sales_bundle__order DROP FOREIGN KEY FK_FBA82B62B03A8386');
$this->addSql('ALTER TABLE sales_bundle__order DROP FOREIGN KEY FK_FBA82B62896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__order DROP FOREIGN KEY FK_FBA82B62C76F1F52');
$this->addSql('ALTER TABLE sales_bundle__order_history DROP FOREIGN KEY FK_C62DA9598D9F6D38');
$this->addSql('ALTER TABLE sales_bundle__order_history DROP FOREIGN KEY FK_C62DA959E420DE70');
$this->addSql('ALTER TABLE sales_bundle__order_history DROP FOREIGN KEY FK_C62DA959B03A8386');
$this->addSql('ALTER TABLE sales_bundle__order_history DROP FOREIGN KEY FK_C62DA959896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__order_line DROP FOREIGN KEY FK_38D3FC518D9F6D38');
$this->addSql('ALTER TABLE sales_bundle__order_line DROP FOREIGN KEY FK_38D3FC5170E80DF4');
$this->addSql('ALTER TABLE sales_bundle__order_line DROP FOREIGN KEY FK_38D3FC513506A35B');
$this->addSql('ALTER TABLE sales_bundle__order_line DROP FOREIGN KEY FK_38D3FC51727ACA70');
$this->addSql('ALTER TABLE sales_bundle__order_line DROP FOREIGN KEY FK_38D3FC51B03A8386');
$this->addSql('ALTER TABLE sales_bundle__order_line DROP FOREIGN KEY FK_38D3FC51896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__order_line DROP FOREIGN KEY FK_38D3FC51C76F1F52');
$this->addSql('ALTER TABLE sales_bundle__order_state DROP FOREIGN KEY FK_EBC823F8B03A8386');
$this->addSql('ALTER TABLE sales_bundle__order_state DROP FOREIGN KEY FK_EBC823F8896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__order_state DROP FOREIGN KEY FK_EBC823F8C76F1F52');
$this->addSql('ALTER TABLE sales_bundle__order_state_translations DROP FOREIGN KEY FK_67B6006B232D562B');
$this->addSql('ALTER TABLE sales_bundle__payment DROP FOREIGN KEY FK_46C1B8056B00C1CF');
$this->addSql('ALTER TABLE sales_bundle__payment DROP FOREIGN KEY FK_46C1B8059395C3F3');
$this->addSql('ALTER TABLE sales_bundle__payment DROP FOREIGN KEY FK_46C1B8051C696F7A');
$this->addSql('ALTER TABLE sales_bundle__payment DROP FOREIGN KEY FK_46C1B8052989F1FD');
$this->addSql('ALTER TABLE sales_bundle__payment DROP FOREIGN KEY FK_46C1B8055AA1164F');
$this->addSql('ALTER TABLE sales_bundle__payment DROP FOREIGN KEY FK_46C1B80511C8FB41');
$this->addSql('ALTER TABLE sales_bundle__payment DROP FOREIGN KEY FK_46C1B80538248176');
$this->addSql('ALTER TABLE sales_bundle__payment DROP FOREIGN KEY FK_46C1B805B03A8386');
$this->addSql('ALTER TABLE sales_bundle__payment DROP FOREIGN KEY FK_46C1B805896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__payment DROP FOREIGN KEY FK_46C1B805C76F1F52');
$this->addSql('ALTER TABLE sales_bundle__payment_method DROP FOREIGN KEY FK_69C1A5D6B03A8386');
$this->addSql('ALTER TABLE sales_bundle__payment_method DROP FOREIGN KEY FK_69C1A5D6896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__payment_method DROP FOREIGN KEY FK_69C1A5D6C76F1F52');
$this->addSql('ALTER TABLE sales_bundle__payment_method_translations DROP FOREIGN KEY FK_38696A97232D562B');
$this->addSql('ALTER TABLE sales_bundle__payment_term DROP FOREIGN KEY FK_DE426A67B03A8386');
$this->addSql('ALTER TABLE sales_bundle__payment_term DROP FOREIGN KEY FK_DE426A67896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__payment_term DROP FOREIGN KEY FK_DE426A67C76F1F52');
$this->addSql('ALTER TABLE sales_bundle__payment_term_translations DROP FOREIGN KEY FK_E2F5FF95232D562B');
$this->addSql('ALTER TABLE sales_bundle__quotation DROP FOREIGN KEY FK_A0FC50DF6B00C1CF');
$this->addSql('ALTER TABLE sales_bundle__quotation DROP FOREIGN KEY FK_A0FC50DF9395C3F3');
$this->addSql('ALTER TABLE sales_bundle__quotation DROP FOREIGN KEY FK_A0FC50DFC6BDFEB');
$this->addSql('ALTER TABLE sales_bundle__quotation DROP FOREIGN KEY FK_A0FC50DFEBF23851');
$this->addSql('ALTER TABLE sales_bundle__quotation DROP FOREIGN KEY FK_A0FC50DF38248176');
$this->addSql('ALTER TABLE sales_bundle__quotation DROP FOREIGN KEY FK_A0FC50DF5AA1164F');
$this->addSql('ALTER TABLE sales_bundle__quotation DROP FOREIGN KEY FK_A0FC50DFC69DE5E5');
$this->addSql('ALTER TABLE sales_bundle__quotation DROP FOREIGN KEY FK_A0FC50DFB03A8386');
$this->addSql('ALTER TABLE sales_bundle__quotation DROP FOREIGN KEY FK_A0FC50DF896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__quotation DROP FOREIGN KEY FK_A0FC50DFC76F1F52');
$this->addSql('ALTER TABLE sales_bundle__quotation_line DROP FOREIGN KEY FK_5E40159AB4EA4E60');
$this->addSql('ALTER TABLE sales_bundle__quotation_line DROP FOREIGN KEY FK_5E40159A70E80DF4');
$this->addSql('ALTER TABLE sales_bundle__quotation_line DROP FOREIGN KEY FK_5E40159A3506A35B');
$this->addSql('ALTER TABLE sales_bundle__quotation_line DROP FOREIGN KEY FK_5E40159A727ACA70');
$this->addSql('ALTER TABLE sales_bundle__quotation_line DROP FOREIGN KEY FK_5E40159AB03A8386');
$this->addSql('ALTER TABLE sales_bundle__quotation_line DROP FOREIGN KEY FK_5E40159A896DBBDE');
$this->addSql('ALTER TABLE sales_bundle__quotation_line DROP FOREIGN KEY FK_5E40159AC76F1F52');
$this->addSql('DROP TABLE sales_bundle__additional_pdf');
$this->addSql('DROP TABLE sales_bundle__bank');
$this->addSql('DROP TABLE sales_bundle__credit_note');
$this->addSql('DROP TABLE sales_bundle__credit_note_line');
$this->addSql('DROP TABLE sales_bundle__customer_options');
$this->addSql('DROP TABLE sales_bundle__delivery_note');
$this->addSql('DROP TABLE sales_bundle__delivery_note_line');
$this->addSql('DROP TABLE sales_bundle__document_payment');
$this->addSql('DROP TABLE sales_bundle__invoice');
$this->addSql('DROP TABLE sales_bundle__invoice_line');
$this->addSql('DROP TABLE sales_bundle__line_type');
$this->addSql('DROP TABLE sales_bundle__line_type_translations');
$this->addSql('DROP TABLE sales_bundle__order');
$this->addSql('DROP TABLE sales_bundle__order_history');
$this->addSql('DROP TABLE sales_bundle__order_line');
$this->addSql('DROP TABLE sales_bundle__order_state');
$this->addSql('DROP TABLE sales_bundle__order_state_translations');
$this->addSql('DROP TABLE sales_bundle__payment');
$this->addSql('DROP TABLE sales_bundle__payment_method');
$this->addSql('DROP TABLE sales_bundle__payment_method_translations');
$this->addSql('DROP TABLE sales_bundle__payment_term');
$this->addSql('DROP TABLE sales_bundle__payment_term_translations');
$this->addSql('DROP TABLE sales_bundle__quotation');
$this->addSql('DROP TABLE sales_bundle__quotation_line');
}
public function postUp(Schema $schema): void
{
parent::postUp($schema);
$now = (new \DateTime())->format('Y-m-d H:i:s');
$configurations = [
'sales_bundle__shared_sales' => true,
'sales_bundle__filter_lists_by_current_user' => false,
'sales_bundle__price_calculation_with_packaging' => false,
'sales_bundle__notify_validation_documents' => true,
'sales_bundle__hide_paid_invoices_in_list' => false,
'sales_bundle__editable_catalog_product_unit_price' => true,
'sales_bundle__quotation_format' => 'DE/[[number]]',
'sales_bundle__invoice_format' => 'FA/[[number]]',
'sales_bundle__credit_note_format' => 'AV/[[number]]',
'sales_bundle__order_format' => 'CMD/[[number]]',
'sales_bundle__delivery_note_format' => 'BL/[[number]]'
];
foreach ($configurations as $configuration => $value) {
$this->connection->insert('configuration', [
'id' => (new UuidV6())->toBinary(),
'name' => $configuration,
'context_id' => null,
'value' => $this->objectSerialize->add((object) ['value' => $value]),
'created_at' => $now,
'updated_at' => $now
]);
}
$fixturesPath = dirname(__FILE__) . '/../src/Resources/views/Pdf/Fixtures/';
$pdfFiles = [
'layout',
'quotation',
'invoice',
'credit_note',
'order',
'delivery_note'
];
foreach ($pdfFiles as $file) {
$fixtureFile = $fixturesPath . $file . '.html.twig';
if (!file_exists($fixtureFile)) {
continue;
}
$content = file_get_contents($fixtureFile);
$this->connection->insert('configuration', [
'id' => (new UuidV6())->toBinary(),
'name' => 'sales_bundle__' . $file . '_pdf',
'context_id' => null,
'value' => $this->objectSerialize->add((object) ['value' => $content]),
'created_at' => $now,
'updated_at' => $now
]);
}
$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';
$lineTypes = [
1 => ['fr' => 'Produit', 'en' => 'Product'],
2 => ['fr' => 'Service', 'en' => 'Service']
];
foreach ($lineTypes as $number => $lineType) {
$lineTypeId = (new UuidV6())->toBinary();
$this->connection->insert('sales_bundle__line_type', [
'id' => $lineTypeId,
'name' => !empty($lineType[$defaultLocale]) ?
$lineType[$defaultLocale] : $lineType[$rootLocale],
'number' => $number,
'is_active' => 1,
'created_at' => $now,
'updated_at' => $now
]);
foreach ($languages as $language) {
$localeTo = $rootLocale;
if (!empty($lineType[$language['locale']])) {
$localeTo = $language['locale'];
} elseif (!empty($lineType[$defaultLocale])) {
$localeTo = $defaultLocale;
}
$this->connection->insert('sales_bundle__line_type_translations', [
'object_id' => $lineTypeId,
'locale' => $language['locale'],
'field' => 'name',
'content' => $lineType[$localeTo]
]);
}
}
$orderStates = [
[
'names' => ['fr' => 'Validé', 'en' => 'Validated'],
'color' => '#2ED631',
'text_color' => '#FFFFFF',
'is_default' => true,
'is_delivered' => false,
'is_invoiced' => false,
'is_canceled' => false
],
[
'names' => ['fr' => 'Partiellement payé', 'en' => 'Partially paid'],
'color' => '#4169E5',
'text_color' => '#FFFFFF',
'is_default' => false,
'is_delivered' => false,
'is_invoiced' => false,
'is_canceled' => false
],
[
'names' => ['fr' => 'Payé', 'en' => 'Paid'],
'color' => '#32CD34',
'text_color' => '#FFFFFF',
'is_default' => false,
'is_delivered' => false,
'is_invoiced' => true,
'is_canceled' => false
],
[
'names' => ['fr' => 'Préparation en cours', 'en' => 'In preparation'],
'color' => '#FF8C01',
'text_color' => '#FFFFFF',
'is_default' => false,
'is_delivered' => false,
'is_invoiced' => false,
'is_canceled' => false
],
[
'names' => ['fr' => 'Expédié', 'en' => 'Shipped'],
'color' => '#BF51ff',
'text_color' => '#FFFFFF',
'is_default' => false,
'is_delivered' => true,
'is_invoiced' => false,
'is_canceled' => false
],
[
'names' => ['fr' => 'Annulé', 'en' => 'Canceled'],
'color' => '#DC143D',
'text_color' => '#FFFFFF',
'is_default' => false,
'is_delivered' => false,
'is_invoiced' => false,
'is_canceled' => true
]
];
foreach ($orderStates as $orderState) {
$orderStateId = (new UuidV6())->toBinary();
$this->connection->insert('sales_bundle__order_state', [
'id' => $orderStateId,
'name' => !empty($orderState['names'][$defaultLocale]) ?
$orderState['names'][$defaultLocale] : $orderState['names'][$rootLocale],
'color' => $orderState['color'],
'text_color' => $orderState['text_color'],
'delivered' => (int) $orderState['is_delivered'],
'invoiced' => (int) $orderState['is_invoiced'],
'canceled' => (int) $orderState['is_canceled'],
'archived' => 0,
'is_active' => 1,
'is_default' => (int) $orderState['is_default'],
'created_at' => $now,
'updated_at' => $now
]);
foreach ($languages as $language) {
$localeTo = $rootLocale;
if (!empty($orderState['names'][$language['locale']])) {
$localeTo = $language['locale'];
} elseif (!empty($orderState['names'][$defaultLocale])) {
$localeTo = $defaultLocale;
}
$this->connection->insert('sales_bundle__order_state_translations', [
'object_id' => $orderStateId,
'locale' => $language['locale'],
'field' => 'name',
'content' => $orderState['names'][$localeTo]
]);
}
}
$paymentMethods = [
[
'names' => ['fr' => 'Facture', 'en' => 'Invoice'],
'is_invoice' => true,
'is_credit_note' => false
],
[
'names' => ['fr' => 'Avoir', 'en' => 'Credit note'],
'is_invoice' => false,
'is_credit_note' => true
],
[
'names' => ['fr' => 'Virement bancaire', 'en' => 'Bank transfer'],
'is_invoice' => false,
'is_credit_note' => false
],
[
'names' => ['fr' => 'Chèque', 'en' => 'Check'],
'is_invoice' => false,
'is_credit_note' => false
],
[
'names' => ['fr' => 'Carte bancaire', 'en' => 'Bank card'],
'is_invoice' => false,
'is_credit_note' => false
]
];
foreach ($paymentMethods as $paymentMethod) {
$paymentMethodId = (new UuidV6())->toBinary();
$this->connection->insert('sales_bundle__payment_method', [
'id' => $paymentMethodId,
'name' => !empty($paymentMethod['names'][$defaultLocale]) ?
$paymentMethod['names'][$defaultLocale] : $paymentMethod['names'][$rootLocale],
'is_active' => 1,
'is_invoice' => (int) $paymentMethod['is_invoice'],
'is_credit_note' => (int) $paymentMethod['is_credit_note'],
'created_at' => $now,
'updated_at' => $now
]);
foreach ($languages as $language) {
$localeTo = $rootLocale;
if (!empty($paymentMethod['names'][$language['locale']])) {
$localeTo = $language['locale'];
} elseif (!empty($paymentMethod['names'][$defaultLocale])) {
$localeTo = $defaultLocale;
}
$this->connection->insert('sales_bundle__payment_method_translations', [
'object_id' => $paymentMethodId,
'locale' => $language['locale'],
'field' => 'name',
'content' => $paymentMethod['names'][$localeTo]
]);
}
}
$paymentTerms = [
[
'names' => ['fr' => 'Paiement immédiat', 'en' => 'Immediate payment'],
'days_delay' => 0,
'end_month' => false,
'default' => false
],
[
'names' => ['fr' => '15 jours net', 'en' => '15 days net'],
'days_delay' => 15,
'end_month' => false,
'default' => true
],
[
'names' => ['fr' => '30 jours fin de mois', 'en' => '30 days end of month'],
'days_delay' => 30,
'end_month' => true,
'default' => false
]
];
foreach ($paymentTerms as $paymentTerm) {
$paymentTermId = (new UuidV6())->toBinary();
$this->connection->insert('sales_bundle__payment_term', [
'id' => $paymentTermId,
'name' => !empty($paymentTerm['names'][$defaultLocale]) ?
$paymentTerm['names'][$defaultLocale] : $paymentTerm['names'][$rootLocale],
'is_active' => 1,
'is_default' => (int) $paymentTerm['default'],
'days_delay' => $paymentTerm['days_delay'],
'end_month' => (int) $paymentTerm['end_month'],
'created_at' => $now,
'updated_at' => $now
]);
foreach ($languages as $language) {
$localeTo = $rootLocale;
if (!empty($paymentTerm['names'][$language['locale']])) {
$localeTo = $language['locale'];
} elseif (!empty($paymentTerm['names'][$defaultLocale])) {
$localeTo = $defaultLocale;
}
$this->connection->insert('sales_bundle__payment_term_translations', [
'object_id' => $paymentTermId,
'locale' => $language['locale'],
'field' => 'name',
'content' => $paymentTerm['names'][$localeTo]
]);
}
}
}
}