migrations/Version20211116134817.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  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 Version20211116134817 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('CREATE TABLE process (id INT AUTO_INCREMENT NOT NULL, product_id INT DEFAULT NULL, yield_amount INT NOT NULL, INDEX IDX_861D18964584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE process_ingredient (id INT AUTO_INCREMENT NOT NULL, process_id INT DEFAULT NULL, inventory_item_id INT DEFAULT NULL, quantity INT NOT NULL, INDEX IDX_C5E45B787EC2F574 (process_id), INDEX IDX_C5E45B78536BF4A2 (inventory_item_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE process ADD CONSTRAINT FK_861D18964584665A FOREIGN KEY (product_id) REFERENCES product (id)');
  21.         $this->addSql('ALTER TABLE process_ingredient ADD CONSTRAINT FK_C5E45B787EC2F574 FOREIGN KEY (process_id) REFERENCES process (id)');
  22.         $this->addSql('ALTER TABLE process_ingredient ADD CONSTRAINT FK_C5E45B78536BF4A2 FOREIGN KEY (inventory_item_id) REFERENCES inventory_item (id)');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('ALTER TABLE process_ingredient DROP FOREIGN KEY FK_C5E45B787EC2F574');
  28.         $this->addSql('DROP TABLE process');
  29.         $this->addSql('DROP TABLE process_ingredient');
  30.     }
  31.     
  32.     public function isTransactional(): bool
  33.     {
  34.         return false;
  35.     }
  36. }