<?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 Version20190912163125 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE nutrition_macro_group_detail DROP FOREIGN KEY FK_DDF16D1ECC39D717');
$this->addSql('DROP INDEX IDX_DDF16D1ECC39D717 ON nutrition_macro_group_detail');
$this->addSql('ALTER TABLE nutrition_macro_group_detail CHANGE item_id `ingredient_id` INT NOT NULL');
$this->addSql('ALTER TABLE nutrition_macro_group_detail ADD CONSTRAINT FK_DDF16D1E3F7B41FD FOREIGN KEY (`ingredient_id`) REFERENCES ingredient (`id`) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_DDF16D1E3F7B41FD ON nutrition_macro_group_detail (`ingredient_id`)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE nutrition_macro_group_detail DROP FOREIGN KEY FK_DDF16D1E3F7B41FD');
$this->addSql('DROP INDEX IDX_DDF16D1E3F7B41FD ON nutrition_macro_group_detail');
$this->addSql('ALTER TABLE nutrition_macro_group_detail CHANGE ingredient_id item_id INT NOT NULL');
$this->addSql('ALTER TABLE nutrition_macro_group_detail ADD CONSTRAINT FK_DDF16D1ECC39D717 FOREIGN KEY (item_id) REFERENCES item (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_DDF16D1ECC39D717 ON nutrition_macro_group_detail (item_id)');
}
}