<?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 Version20190709174605 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 organization_unit ADD parent_id INT DEFAULT NULL, ADD path VARCHAR(3000) DEFAULT NULL, ADD level INT DEFAULT NULL, ADD code VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE organization_unit ADD CONSTRAINT FK_E5B232CE727ACA70 FOREIGN KEY (parent_id) REFERENCES organization_unit (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_E5B232CE727ACA70 ON organization_unit (parent_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 organization_unit DROP FOREIGN KEY FK_E5B232CE727ACA70');
$this->addSql('DROP INDEX IDX_E5B232CE727ACA70 ON organization_unit');
$this->addSql('ALTER TABLE organization_unit DROP parent_id, DROP path, DROP level, DROP code');
}
}