<?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 Version20211116134817 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 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');
$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');
$this->addSql('ALTER TABLE process ADD CONSTRAINT FK_861D18964584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('ALTER TABLE process_ingredient ADD CONSTRAINT FK_C5E45B787EC2F574 FOREIGN KEY (process_id) REFERENCES process (id)');
$this->addSql('ALTER TABLE process_ingredient ADD CONSTRAINT FK_C5E45B78536BF4A2 FOREIGN KEY (inventory_item_id) REFERENCES inventory_item (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE process_ingredient DROP FOREIGN KEY FK_C5E45B787EC2F574');
$this->addSql('DROP TABLE process');
$this->addSql('DROP TABLE process_ingredient');
}
public function isTransactional(): bool
{
return false;
}
}