<?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 Version20200407112838 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() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE measurements ADD standard_recipe_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE measurements ADD CONSTRAINT FK_71920F21F28BBC1C FOREIGN KEY (standard_recipe_id) REFERENCES recipes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_71920F21F28BBC1C ON measurements (standard_recipe_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() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE measurements DROP CONSTRAINT FK_71920F21F28BBC1C');
$this->addSql('DROP INDEX IDX_71920F21F28BBC1C');
$this->addSql('ALTER TABLE measurements DROP standard_recipe_id');
}
}