<?php
declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20201217141337 extends AbstractMigration
{
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE non_petroleum_substance_ec (id INT AUTO_INCREMENT NOT NULL, ec VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\', UNIQUE INDEX UNIQ_3DE388928DE8BDFF (ec), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE legal_entity_cart_line ADD non_petroleum_ec_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE legal_entity_cart_line ADD CONSTRAINT FK_40AD22B2F06AED40 FOREIGN KEY (non_petroleum_ec_id) REFERENCES non_petroleum_substance_ec (id)');
$this->addSql('CREATE INDEX IDX_40AD22B2F06AED40 ON legal_entity_cart_line (non_petroleum_ec_id)');
$this->addSql('ALTER TABLE legal_entity_active_definition ADD non_petroleum_ec_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE legal_entity_active_definition ADD CONSTRAINT FK_CF711C4BF06AED40 FOREIGN KEY (non_petroleum_ec_id) REFERENCES non_petroleum_substance_ec (id)');
$this->addSql('CREATE INDEX IDX_CF711C4BF06AED40 ON legal_entity_active_definition (non_petroleum_ec_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE legal_entity_cart_line DROP FOREIGN KEY FK_40AD22B2F06AED40');
$this->addSql('ALTER TABLE legal_entity_active_definition DROP FOREIGN KEY FK_CF711C4BF06AED40');
$this->addSql('DROP TABLE non_petroleum_substance_ec');
$this->addSql('DROP INDEX IDX_CF711C4BF06AED40 ON legal_entity_active_definition');
$this->addSql('ALTER TABLE legal_entity_active_definition DROP non_petroleum_ec_id');
$this->addSql('DROP INDEX IDX_40AD22B2F06AED40 ON legal_entity_cart_line');
$this->addSql('ALTER TABLE legal_entity_cart_line DROP non_petroleum_ec_id');
}
}