migrations/Inventory/Version20220901145910_InventoryWithdrawalItem.php line 1

  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations\Inventory;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220901145910_InventoryWithdrawalItem extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Add inventory withdrawal item table';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $this->addSql("CREATE TABLE inventory_withdrawal_item (
  18.             id                              SERIAL PRIMARY KEY,
  19.             withdrawal_id                   INTEGER                     NOT NULL REFERENCES public.inventory_withdrawal (id),
  20.             inventory_item_id               INTEGER                     NOT NULL REFERENCES public.inventory_item (id),
  21.             requested_quantity              INTEGER                     NOT NULL,
  22.             approved_quantity               INTEGER,
  23.             remitted_quantity               INTEGER
  24.         )");
  25.         $this->addSql("CREATE INDEX inventory_withdrawal_item_withdrawal_id_idx ON inventory_withdrawal_item (withdrawal_id)");
  26.         $this->addSql("CREATE INDEX inventory_withdrawal_item_inventory_item_id_idx ON inventory_withdrawal_item (inventory_item_id)");
  27.     }
  28.     public function down(Schema $schema): void
  29.     {
  30.         $this->addSql("DROP TABLE IF EXISTS inventory_withdrawal_item");
  31.     }
  32. }