<?php
declare(strict_types=1);
namespace CoreMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221209091736 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE bundle (id INT AUTO_INCREMENT NOT NULL, created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', updated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(255) NOT NULL, namespace VARCHAR(255) NOT NULL, version VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_A57B32FDB03A8386 (created_by_id), INDEX IDX_A57B32FD896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE stocks_bundle__stock_product_root (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_id BINARY(16) NOT 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)\', quantity INT NOT NULL, quantity_in_order INT NOT NULL, quantity_simulated INT NOT NULL, quantity_available INT NOT NULL, quantity_to_hold INT DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_436271BB4584665A (product_id), UNIQUE INDEX UNIQ_436271BB9941A932 (declination_id), INDEX IDX_436271BBB03A8386 (created_by_id), INDEX IDX_436271BB896DBBDE (updated_by_id), INDEX IDX_436271BBC76F1F52 (deleted_by_id), INDEX quantity (quantity), INDEX quantity_in_order (quantity_in_order), INDEX quantity_simulated (quantity_simulated), INDEX quantity_to_hold (quantity_to_hold), 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 bundle ADD CONSTRAINT FK_A57B32FDB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE bundle ADD CONSTRAINT FK_A57B32FD896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root ADD CONSTRAINT FK_436271BB4584665A FOREIGN KEY (product_id) REFERENCES products_bundle__product (id)');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root ADD CONSTRAINT FK_436271BB9941A932 FOREIGN KEY (declination_id) REFERENCES products_bundle__declination (id)');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root ADD CONSTRAINT FK_436271BBB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root ADD CONSTRAINT FK_436271BB896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root ADD CONSTRAINT FK_436271BBC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__stock_product ADD stock_product_root_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE stocks_bundle__stock_product ADD CONSTRAINT FK_3D03C46049760897 FOREIGN KEY (stock_product_root_id) REFERENCES stocks_bundle__stock_product_root (id)');
$this->addSql('CREATE INDEX IDX_3D03C46049760897 ON stocks_bundle__stock_product (stock_product_root_id)');
$this->addSql('ALTER TABLE tax ADD product_sales_account_number VARCHAR(32) DEFAULT NULL, ADD service_sales_account_number VARCHAR(32) DEFAULT NULL');
$this->addSql('CREATE INDEX product_sales_account_number ON tax (product_sales_account_number)');
$this->addSql('CREATE INDEX service_sales_account_number ON tax (service_sales_account_number)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE stocks_bundle__stock_product DROP FOREIGN KEY FK_3D03C46049760897');
$this->addSql('ALTER TABLE bundle DROP FOREIGN KEY FK_A57B32FDB03A8386');
$this->addSql('ALTER TABLE bundle DROP FOREIGN KEY FK_A57B32FD896DBBDE');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root DROP FOREIGN KEY FK_436271BB4584665A');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root DROP FOREIGN KEY FK_436271BB9941A932');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root DROP FOREIGN KEY FK_436271BBB03A8386');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root DROP FOREIGN KEY FK_436271BB896DBBDE');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root DROP FOREIGN KEY FK_436271BBC76F1F52');
$this->addSql('DROP TABLE bundle');
$this->addSql('DROP TABLE stocks_bundle__stock_product_root');
$this->addSql('DROP INDEX IDX_3D03C46049760897 ON stocks_bundle__stock_product');
$this->addSql('ALTER TABLE stocks_bundle__stock_product DROP stock_product_root_id');
$this->addSql('DROP INDEX product_sales_account_number ON tax');
$this->addSql('DROP INDEX service_sales_account_number ON tax');
$this->addSql('ALTER TABLE tax DROP product_sales_account_number, DROP service_sales_account_number');
}
}