<?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 Version20220714214201 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 meal (id INT AUTO_INCREMENT NOT NULL, type_id INT NOT NULL, callories_in100_grams NUMERIC(10, 4) NOT NULL, INDEX IDX_9EF68E9CC54C8C93 (type_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE meal_translation (id INT AUTO_INCREMENT NOT NULL, meal_id INT NOT NULL, lang VARCHAR(4) NOT NULL, name VARCHAR(255) DEFAULT NULL, INDEX IDX_B99343E7639666D6 (meal_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE meal ADD CONSTRAINT FK_9EF68E9CC54C8C93 FOREIGN KEY (type_id) REFERENCES meal_type (id)');
$this->addSql('ALTER TABLE meal_translation ADD CONSTRAINT FK_B99343E7639666D6 FOREIGN KEY (meal_id) REFERENCES meal (id)');
$this->addSql('ALTER TABLE recipe_ingredient CHANGE quantity quantity NUMERIC(10, 4) DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE meal_translation DROP FOREIGN KEY FK_B99343E7639666D6');
$this->addSql('DROP TABLE meal');
$this->addSql('DROP TABLE meal_translation');
$this->addSql('ALTER TABLE recipe_ingredient CHANGE quantity quantity NUMERIC(10, 4) NOT NULL');
}
}