<?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 Version20220603075146 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 product_returns_bundle__converted_document (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', product_return_line_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', order_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)\', quantity NUMERIC(20, 6) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_3D4C864383A19B1 (product_return_line_id), INDEX IDX_3D4C86438D9F6D38 (order_id), INDEX IDX_3D4C86431C696F7A (credit_note_id), INDEX IDX_3D4C8643B03A8386 (created_by_id), INDEX IDX_3D4C8643896DBBDE (updated_by_id), INDEX IDX_3D4C8643C76F1F52 (deleted_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE product_returns_bundle__converted_document ADD CONSTRAINT FK_3D4C864383A19B1 FOREIGN KEY (product_return_line_id) REFERENCES product_returns_bundle__product_return_line (id)');
$this->addSql('ALTER TABLE product_returns_bundle__converted_document ADD CONSTRAINT FK_3D4C86438D9F6D38 FOREIGN KEY (order_id) REFERENCES sales_bundle__order (id)');
$this->addSql('ALTER TABLE product_returns_bundle__converted_document ADD CONSTRAINT FK_3D4C86431C696F7A FOREIGN KEY (credit_note_id) REFERENCES sales_bundle__credit_note (id)');
$this->addSql('ALTER TABLE product_returns_bundle__converted_document ADD CONSTRAINT FK_3D4C8643B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE product_returns_bundle__converted_document ADD CONSTRAINT FK_3D4C8643896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE product_returns_bundle__converted_document ADD CONSTRAINT FK_3D4C8643C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE currency CHANGE change_rate change_rate NUMERIC(20, 12) DEFAULT \'1\' NOT NULL');
$this->addSql('ALTER TABLE product_returns_bundle__product_return_line DROP FOREIGN KEY FK_9D41AD32477F688');
$this->addSql('ALTER TABLE product_returns_bundle__product_return_line DROP FOREIGN KEY FK_9D41AD365176536');
$this->addSql('DROP INDEX IDX_9D41AD32477F688 ON product_returns_bundle__product_return_line');
$this->addSql('DROP INDEX IDX_9D41AD365176536 ON product_returns_bundle__product_return_line');
$this->addSql('ALTER TABLE product_returns_bundle__product_return_line DROP transformed_order_id, DROP transformed_credit_note_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE product_returns_bundle__converted_document');
$this->addSql('ALTER TABLE currency CHANGE change_rate change_rate NUMERIC(20, 12) DEFAULT \'1.000000000000\' NOT NULL');
$this->addSql('ALTER TABLE product_returns_bundle__product_return_line ADD transformed_order_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', ADD transformed_credit_note_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE product_returns_bundle__product_return_line ADD CONSTRAINT FK_9D41AD32477F688 FOREIGN KEY (transformed_order_id) REFERENCES sales_bundle__order (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('ALTER TABLE product_returns_bundle__product_return_line ADD CONSTRAINT FK_9D41AD365176536 FOREIGN KEY (transformed_credit_note_id) REFERENCES sales_bundle__credit_note (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('CREATE INDEX IDX_9D41AD32477F688 ON product_returns_bundle__product_return_line (transformed_order_id)');
$this->addSql('CREATE INDEX IDX_9D41AD365176536 ON product_returns_bundle__product_return_line (transformed_credit_note_id)');
}
}