<?php
declare(strict_types=1);
namespace StocksBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20240805143749 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE stocks_bundle__stock_product_root_context (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_product_root_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_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 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, out_of_stock_limit INT DEFAULT NULL, not_send_oos_alert TINYINT(1) DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_DF9F9A54584665A (product_id), INDEX IDX_DF9F9A59941A932 (declination_id), INDEX IDX_DF9F9A549760897 (stock_product_root_id), INDEX IDX_DF9F9A56B00C1CF (context_id), INDEX IDX_DF9F9A5B03A8386 (created_by_id), INDEX IDX_DF9F9A5896DBBDE (updated_by_id), INDEX IDX_DF9F9A5C76F1F52 (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 out_of_stock_limit (out_of_stock_limit), INDEX not_send_oos_alert (not_send_oos_alert), 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__stock_product_root_context ADD CONSTRAINT FK_DF9F9A54584665A FOREIGN KEY (product_id) REFERENCES products_bundle__product (id)');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root_context ADD CONSTRAINT FK_DF9F9A59941A932 FOREIGN KEY (declination_id) REFERENCES products_bundle__declination (id)');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root_context ADD CONSTRAINT FK_DF9F9A549760897 FOREIGN KEY (stock_product_root_id) REFERENCES stocks_bundle__stock_product_root (id)');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root_context ADD CONSTRAINT FK_DF9F9A56B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root_context ADD CONSTRAINT FK_DF9F9A5B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root_context ADD CONSTRAINT FK_DF9F9A5896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root_context ADD CONSTRAINT FK_DF9F9A5C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root_context DROP FOREIGN KEY FK_DF9F9A54584665A');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root_context DROP FOREIGN KEY FK_DF9F9A59941A932');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root_context DROP FOREIGN KEY FK_DF9F9A549760897');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root_context DROP FOREIGN KEY FK_DF9F9A56B00C1CF');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root_context DROP FOREIGN KEY FK_DF9F9A5B03A8386');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root_context DROP FOREIGN KEY FK_DF9F9A5896DBBDE');
$this->addSql('ALTER TABLE stocks_bundle__stock_product_root_context DROP FOREIGN KEY FK_DF9F9A5C76F1F52');
$this->addSql('DROP TABLE stocks_bundle__stock_product_root_context');
}
}