<?php
declare(strict_types=1);
namespace StocksBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20231003081326 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE stocks_bundle__mass_stock_entry (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', manager_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', closed_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)\', validated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', closed_at DATETIME DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, validated_at DATETIME DEFAULT NULL, INDEX IDX_D7D8B56F783E3463 (manager_id), INDEX IDX_D7D8B56FE1FA7797 (closed_by_id), INDEX IDX_D7D8B56FB03A8386 (created_by_id), INDEX IDX_D7D8B56F896DBBDE (updated_by_id), INDEX IDX_D7D8B56FC76F1F52 (deleted_by_id), INDEX IDX_D7D8B56FC69DE5E5 (validated_by_id), INDEX validated_at (validated_at), INDEX closed_at (closed_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 stocks_bundle__mass_stock_entry_line (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', mass_stock_entry_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)\', stock_location_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', warehouse_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', location_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', sub_location_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', date_type_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)\', expected_quantity INT NOT NULL, quantity INT NOT NULL, date DATETIME DEFAULT NULL, batch_number VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_F01CAD89B1EC6CA9 (mass_stock_entry_id), INDEX IDX_F01CAD894584665A (product_id), INDEX IDX_F01CAD899941A932 (declination_id), INDEX IDX_F01CAD89D98387BA (stock_location_id), INDEX IDX_F01CAD895080ECDE (warehouse_id), INDEX IDX_F01CAD8964D218E (location_id), INDEX IDX_F01CAD89E3B45410 (sub_location_id), INDEX IDX_F01CAD89FCAB8B6E (date_type_id), INDEX IDX_F01CAD89B03A8386 (created_by_id), INDEX IDX_F01CAD89896DBBDE (updated_by_id), INDEX IDX_F01CAD89C76F1F52 (deleted_by_id), INDEX expected_quantity (expected_quantity), INDEX quantity (quantity), INDEX date (date), INDEX batch_number (batch_number), 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 stocks_bundle__mass_stock_entry ADD CONSTRAINT FK_D7D8B56F783E3463 FOREIGN KEY (manager_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry ADD CONSTRAINT FK_D7D8B56FE1FA7797 FOREIGN KEY (closed_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry ADD CONSTRAINT FK_D7D8B56FB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry ADD CONSTRAINT FK_D7D8B56F896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry ADD CONSTRAINT FK_D7D8B56FC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry ADD CONSTRAINT FK_D7D8B56FC69DE5E5 FOREIGN KEY (validated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line ADD CONSTRAINT FK_F01CAD89B1EC6CA9 FOREIGN KEY (mass_stock_entry_id) REFERENCES stocks_bundle__mass_stock_entry (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line ADD CONSTRAINT FK_F01CAD894584665A FOREIGN KEY (product_id) REFERENCES products_bundle__product (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line ADD CONSTRAINT FK_F01CAD899941A932 FOREIGN KEY (declination_id) REFERENCES products_bundle__declination (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line ADD CONSTRAINT FK_F01CAD89D98387BA FOREIGN KEY (stock_location_id) REFERENCES stocks_bundle__stock_location (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line ADD CONSTRAINT FK_F01CAD895080ECDE FOREIGN KEY (warehouse_id) REFERENCES stocks_bundle__warehouse (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line ADD CONSTRAINT FK_F01CAD8964D218E FOREIGN KEY (location_id) REFERENCES stocks_bundle__location (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line ADD CONSTRAINT FK_F01CAD89E3B45410 FOREIGN KEY (sub_location_id) REFERENCES stocks_bundle__sub_location (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line ADD CONSTRAINT FK_F01CAD89FCAB8B6E FOREIGN KEY (date_type_id) REFERENCES stocks_bundle__date_type (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line ADD CONSTRAINT FK_F01CAD89B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line ADD CONSTRAINT FK_F01CAD89896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line ADD CONSTRAINT FK_F01CAD89C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('CREATE TABLE stocks_bundle__warehouse_user (warehouse_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', user_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_F80475125080ECDE (warehouse_id), INDEX IDX_F8047512A76ED395 (user_id), PRIMARY KEY(warehouse_id, user_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE stocks_bundle__warehouse_user ADD CONSTRAINT FK_F80475125080ECDE FOREIGN KEY (warehouse_id) REFERENCES stocks_bundle__warehouse (id)');
$this->addSql('ALTER TABLE stocks_bundle__warehouse_user ADD CONSTRAINT FK_F8047512A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry DROP FOREIGN KEY FK_D7D8B56F783E3463');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry DROP FOREIGN KEY FK_D7D8B56FE1FA7797');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry DROP FOREIGN KEY FK_D7D8B56FB03A8386');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry DROP FOREIGN KEY FK_D7D8B56F896DBBDE');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry DROP FOREIGN KEY FK_D7D8B56FC76F1F52');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry DROP FOREIGN KEY FK_D7D8B56FC69DE5E5');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line DROP FOREIGN KEY FK_F01CAD89B1EC6CA9');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line DROP FOREIGN KEY FK_F01CAD894584665A');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line DROP FOREIGN KEY FK_F01CAD899941A932');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line DROP FOREIGN KEY FK_F01CAD89D98387BA');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line DROP FOREIGN KEY FK_F01CAD895080ECDE');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line DROP FOREIGN KEY FK_F01CAD8964D218E');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line DROP FOREIGN KEY FK_F01CAD89E3B45410');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line DROP FOREIGN KEY FK_F01CAD89FCAB8B6E');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line DROP FOREIGN KEY FK_F01CAD89B03A8386');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line DROP FOREIGN KEY FK_F01CAD89896DBBDE');
$this->addSql('ALTER TABLE stocks_bundle__mass_stock_entry_line DROP FOREIGN KEY FK_F01CAD89C76F1F52');
$this->addSql('DROP TABLE stocks_bundle__mass_stock_entry');
$this->addSql('DROP TABLE stocks_bundle__mass_stock_entry_line');
$this->addSql('ALTER TABLE stocks_bundle__warehouse_user DROP FOREIGN KEY FK_F80475125080ECDE');
$this->addSql('ALTER TABLE stocks_bundle__warehouse_user DROP FOREIGN KEY FK_F8047512A76ED395');
$this->addSql('DROP TABLE stocks_bundle__warehouse_user');
}
}