<?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 Version20220710215225 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 recipe (id INT AUTO_INCREMENT NOT NULL, is_hot TINYINT(1) NOT NULL, is_locked TINYINT(1) NOT NULL, is_portion TINYINT(1) NOT NULL, image_path VARCHAR(255) DEFAULT NULL, is_deleted TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE recipe_ingredient (id INT AUTO_INCREMENT NOT NULL, recipe_id INT NOT NULL, ingredient_id INT NOT NULL, unit_id INT DEFAULT NULL, quantity NUMERIC(10, 4) NOT NULL, INDEX IDX_22D1FE1359D8A214 (recipe_id), INDEX IDX_22D1FE13933FE08C (ingredient_id), INDEX IDX_22D1FE13F8BD700D (unit_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE recipe_step (id INT AUTO_INCREMENT NOT NULL, recipe_id INT NOT NULL, action_id INT DEFAULT NULL, workstation_id INT DEFAULT NULL, ingredient_id INT DEFAULT NULL, position INT NOT NULL, INDEX IDX_3CA2A4E359D8A214 (recipe_id), INDEX IDX_3CA2A4E39D32F035 (action_id), INDEX IDX_3CA2A4E3E29BB7D (workstation_id), INDEX IDX_3CA2A4E3933FE08C (ingredient_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE recipe_step_translation (id INT AUTO_INCREMENT NOT NULL, recipe_step_id INT NOT NULL, lang VARCHAR(4) NOT NULL, name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, INDEX IDX_F1D306693F5610DC (recipe_step_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE recipe_translation (id INT AUTO_INCREMENT NOT NULL, recipe_id INT NOT NULL, lang VARCHAR(4) NOT NULL, name VARCHAR(255) DEFAULT NULL, kitchen_note LONGTEXT DEFAULT NULL, packing_note LONGTEXT DEFAULT NULL, dietitians_note LONGTEXT DEFAULT NULL, INDEX IDX_609B0B0B59D8A214 (recipe_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE recipe_ingredient ADD CONSTRAINT FK_22D1FE1359D8A214 FOREIGN KEY (recipe_id) REFERENCES recipe (id)');
$this->addSql('ALTER TABLE recipe_ingredient ADD CONSTRAINT FK_22D1FE13933FE08C FOREIGN KEY (ingredient_id) REFERENCES ingredient_form (id)');
$this->addSql('ALTER TABLE recipe_ingredient ADD CONSTRAINT FK_22D1FE13F8BD700D FOREIGN KEY (unit_id) REFERENCES unit (id)');
$this->addSql('ALTER TABLE recipe_step ADD CONSTRAINT FK_3CA2A4E359D8A214 FOREIGN KEY (recipe_id) REFERENCES recipe (id)');
$this->addSql('ALTER TABLE recipe_step ADD CONSTRAINT FK_3CA2A4E39D32F035 FOREIGN KEY (action_id) REFERENCES action (id)');
$this->addSql('ALTER TABLE recipe_step ADD CONSTRAINT FK_3CA2A4E3E29BB7D FOREIGN KEY (workstation_id) REFERENCES workstation (id)');
$this->addSql('ALTER TABLE recipe_step ADD CONSTRAINT FK_3CA2A4E3933FE08C FOREIGN KEY (ingredient_id) REFERENCES ingredient_form (id)');
$this->addSql('ALTER TABLE recipe_step_translation ADD CONSTRAINT FK_F1D306693F5610DC FOREIGN KEY (recipe_step_id) REFERENCES recipe_step (id)');
$this->addSql('ALTER TABLE recipe_translation ADD CONSTRAINT FK_609B0B0B59D8A214 FOREIGN KEY (recipe_id) REFERENCES recipe (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE recipe_ingredient DROP FOREIGN KEY FK_22D1FE1359D8A214');
$this->addSql('ALTER TABLE recipe_step DROP FOREIGN KEY FK_3CA2A4E359D8A214');
$this->addSql('ALTER TABLE recipe_translation DROP FOREIGN KEY FK_609B0B0B59D8A214');
$this->addSql('ALTER TABLE recipe_step_translation DROP FOREIGN KEY FK_F1D306693F5610DC');
$this->addSql('DROP TABLE recipe');
$this->addSql('DROP TABLE recipe_ingredient');
$this->addSql('DROP TABLE recipe_step');
$this->addSql('DROP TABLE recipe_step_translation');
$this->addSql('DROP TABLE recipe_translation');
}
}