vendor/bluue/shipments-bundle/migrations/Version20240625081608.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace ShipmentsBundleMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. final class Version20240625081608 extends AbstractMigration
  7. {
  8.     public function up(Schema $schema): void
  9.     {
  10.         $this->addSql('CREATE TABLE shipments_bundle__order_preparation_history (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', burst_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', order_options_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', order_line_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)\', controlled_quantity NUMERIC(20, 6) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_F35CDD6BCC799A1F (burst_id), INDEX IDX_F35CDD6B8901F8A4 (order_options_id), INDEX IDX_F35CDD6BBB01DC09 (order_line_id), INDEX IDX_F35CDD6BB03A8386 (created_by_id), INDEX IDX_F35CDD6B896DBBDE (updated_by_id), INDEX created_at (created_at), INDEX updated_at (updated_at), INDEX controlled_quantity (controlled_quantity), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  11.         $this->addSql('ALTER TABLE shipments_bundle__order_preparation_history ADD CONSTRAINT FK_F35CDD6BCC799A1F FOREIGN KEY (burst_id) REFERENCES shipments_bundle__burst (id)');
  12.         $this->addSql('ALTER TABLE shipments_bundle__order_preparation_history ADD CONSTRAINT FK_F35CDD6B8901F8A4 FOREIGN KEY (order_options_id) REFERENCES shipments_bundle__order_options (id)');
  13.         $this->addSql('ALTER TABLE shipments_bundle__order_preparation_history ADD CONSTRAINT FK_F35CDD6BBB01DC09 FOREIGN KEY (order_line_id) REFERENCES sales_bundle__order_line (id)');
  14.         $this->addSql('ALTER TABLE shipments_bundle__order_preparation_history ADD CONSTRAINT FK_F35CDD6BB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
  15.         $this->addSql('ALTER TABLE shipments_bundle__order_preparation_history ADD CONSTRAINT FK_F35CDD6B896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
  16.         $this->addSql('ALTER TABLE shipments_bundle__order_options ADD shopping_cart_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', ADD shopping_cart_location_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
  17.         $this->addSql('ALTER TABLE shipments_bundle__order_options ADD CONSTRAINT FK_3F7A5CB145F80CD FOREIGN KEY (shopping_cart_id) REFERENCES shipments_bundle__shopping_cart (id)');
  18.         $this->addSql('ALTER TABLE shipments_bundle__order_options ADD CONSTRAINT FK_3F7A5CB12CE932F6 FOREIGN KEY (shopping_cart_location_id) REFERENCES shipments_bundle__shopping_cart_location (id)');
  19.         $this->addSql('CREATE INDEX IDX_3F7A5CB145F80CD ON shipments_bundle__order_options (shopping_cart_id)');
  20.         $this->addSql('CREATE INDEX IDX_3F7A5CB12CE932F6 ON shipments_bundle__order_options (shopping_cart_location_id)');
  21.         $this->addSql('ALTER TABLE shipments_bundle__picking_history ADD order_line_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\'');
  22.         $this->addSql('ALTER TABLE shipments_bundle__picking_history ADD CONSTRAINT FK_F9B6EAE7BB01DC09 FOREIGN KEY (order_line_id) REFERENCES sales_bundle__order_line (id)');
  23.         $this->addSql('CREATE INDEX IDX_F9B6EAE7BB01DC09 ON shipments_bundle__picking_history (order_line_id)');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         $this->addSql('ALTER TABLE shipments_bundle__order_preparation_history DROP FOREIGN KEY FK_F35CDD6BCC799A1F');
  28.         $this->addSql('ALTER TABLE shipments_bundle__order_preparation_history DROP FOREIGN KEY FK_F35CDD6B8901F8A4');
  29.         $this->addSql('ALTER TABLE shipments_bundle__order_preparation_history DROP FOREIGN KEY FK_F35CDD6BBB01DC09');
  30.         $this->addSql('ALTER TABLE shipments_bundle__order_preparation_history DROP FOREIGN KEY FK_F35CDD6BB03A8386');
  31.         $this->addSql('ALTER TABLE shipments_bundle__order_preparation_history DROP FOREIGN KEY FK_F35CDD6B896DBBDE');
  32.         $this->addSql('DROP TABLE shipments_bundle__order_preparation_history');
  33.         $this->addSql('ALTER TABLE shipments_bundle__order_options DROP FOREIGN KEY FK_3F7A5CB145F80CD');
  34.         $this->addSql('ALTER TABLE shipments_bundle__order_options DROP FOREIGN KEY FK_3F7A5CB12CE932F6');
  35.         $this->addSql('DROP INDEX IDX_3F7A5CB145F80CD ON shipments_bundle__order_options');
  36.         $this->addSql('DROP INDEX IDX_3F7A5CB12CE932F6 ON shipments_bundle__order_options');
  37.         $this->addSql('ALTER TABLE shipments_bundle__order_options DROP shopping_cart_id, DROP shopping_cart_location_id');
  38.         $this->addSql('ALTER TABLE shipments_bundle__picking_history DROP FOREIGN KEY FK_F9B6EAE7BB01DC09');
  39.         $this->addSql('DROP INDEX IDX_F9B6EAE7BB01DC09 ON shipments_bundle__picking_history');
  40.         $this->addSql('ALTER TABLE shipments_bundle__picking_history DROP order_line_id');
  41.     }
  42. }