migrations/Version20250807160356.php line 1
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250807160356 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 estimated_packings (id INT AUTO_INCREMENT NOT NULL, shipment_id INT NOT NULL, createdAt DATETIME NOT NULL, createdBy VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_F1B166C67BE036FC (shipment_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE estimated_packing_customer_order_lines (estimatedpacking_id INT NOT NULL, customerorderline_id INT NOT NULL, INDEX IDX_282F6D2686B9A738 (estimatedpacking_id), INDEX IDX_282F6D262A311BE2 (customerorderline_id), PRIMARY KEY(estimatedpacking_id, customerorderline_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE estimated_packings ADD CONSTRAINT FK_F1B166C67BE036FC FOREIGN KEY (shipment_id) REFERENCES shipments (id)');
$this->addSql('ALTER TABLE estimated_packing_customer_order_lines ADD CONSTRAINT FK_282F6D2686B9A738 FOREIGN KEY (estimatedpacking_id) REFERENCES estimated_packings (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE estimated_packing_customer_order_lines ADD CONSTRAINT FK_282F6D262A311BE2 FOREIGN KEY (customerorderline_id) REFERENCES customer_order_lines (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE packings ADD estimatedPacking_id INT DEFAULT NULL, CHANGE shipment_id shipment_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE packings ADD CONSTRAINT FK_63E6B145C9E4A4E8 FOREIGN KEY (estimatedPacking_id) REFERENCES estimated_packings (id)');
$this->addSql('CREATE INDEX IDX_63E6B145C9E4A4E8 ON packings (estimatedPacking_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE packings DROP FOREIGN KEY FK_63E6B145C9E4A4E8');
$this->addSql('ALTER TABLE estimated_packings DROP FOREIGN KEY FK_F1B166C67BE036FC');
$this->addSql('ALTER TABLE estimated_packing_customer_order_lines DROP FOREIGN KEY FK_282F6D2686B9A738');
$this->addSql('ALTER TABLE estimated_packing_customer_order_lines DROP FOREIGN KEY FK_282F6D262A311BE2');
$this->addSql('DROP TABLE estimated_packings');
$this->addSql('DROP TABLE estimated_packing_customer_order_lines');
$this->addSql('DROP INDEX IDX_63E6B145C9E4A4E8 ON packings');
$this->addSql('ALTER TABLE packings DROP estimatedPacking_id, CHANGE shipment_id shipment_id INT NOT NULL');
}
}