<?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 Version20200329144242 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 recipes ADD created_from_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE recipes ADD CONSTRAINT FK_A369E2B53EA4CB4D FOREIGN KEY (created_from_id) REFERENCES recipes (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_A369E2B53EA4CB4D ON recipes (created_from_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 recipes DROP CONSTRAINT FK_A369E2B53EA4CB4D');
$this->addSql('DROP INDEX IDX_A369E2B53EA4CB4D');
$this->addSql('ALTER TABLE recipes DROP created_from_id');
}
}