vendor/bluue/inventories-bundle/migrations/Version20230405140456.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace InventoriesBundleMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. final class Version20230405140456 extends AbstractMigration
  7. {
  8.     public function up(Schema $schema): void
  9.     {
  10.         $this->addSql('CREATE TABLE inventories_bundle__inventory_original_product_quantity (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', inventory_original_product_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', stock_location_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 INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_DB3F60ABB07E756E (inventory_original_product_id), INDEX IDX_DB3F60ABD98387BA (stock_location_id), INDEX IDX_DB3F60ABB03A8386 (created_by_id), INDEX IDX_DB3F60AB896DBBDE (updated_by_id), INDEX IDX_DB3F60ABC76F1F52 (deleted_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  11.         $this->addSql('ALTER TABLE inventories_bundle__inventory_original_product_quantity ADD CONSTRAINT FK_DB3F60ABB07E756E FOREIGN KEY (inventory_original_product_id) REFERENCES inventories_bundle__inventory_original_product (id)');
  12.         $this->addSql('ALTER TABLE inventories_bundle__inventory_original_product_quantity ADD CONSTRAINT FK_DB3F60ABD98387BA FOREIGN KEY (stock_location_id) REFERENCES stocks_bundle__stock_location (id)');
  13.         $this->addSql('ALTER TABLE inventories_bundle__inventory_original_product_quantity ADD CONSTRAINT FK_DB3F60ABB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
  14.         $this->addSql('ALTER TABLE inventories_bundle__inventory_original_product_quantity ADD CONSTRAINT FK_DB3F60AB896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
  15.         $this->addSql('ALTER TABLE inventories_bundle__inventory_original_product_quantity ADD CONSTRAINT FK_DB3F60ABC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
  16.         $this->addSql('ALTER TABLE inventories_bundle__inventory_original_product DROP quantity');
  17.     }
  18.     public function down(Schema $schema): void
  19.     {
  20.         $this->addSql('ALTER TABLE inventories_bundle__inventory_original_product_quantity DROP FOREIGN KEY FK_DB3F60ABB07E756E');
  21.         $this->addSql('ALTER TABLE inventories_bundle__inventory_original_product_quantity DROP FOREIGN KEY FK_DB3F60ABD98387BA');
  22.         $this->addSql('ALTER TABLE inventories_bundle__inventory_original_product_quantity DROP FOREIGN KEY FK_DB3F60ABB03A8386');
  23.         $this->addSql('ALTER TABLE inventories_bundle__inventory_original_product_quantity DROP FOREIGN KEY FK_DB3F60AB896DBBDE');
  24.         $this->addSql('ALTER TABLE inventories_bundle__inventory_original_product_quantity DROP FOREIGN KEY FK_DB3F60ABC76F1F52');
  25.         $this->addSql('DROP TABLE inventories_bundle__inventory_original_product_quantity');
  26.         $this->addSql('ALTER TABLE inventories_bundle__inventory_original_product ADD quantity INT NOT NULL');
  27.     }
  28. }