<?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 Version20210127130941 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('ALTER TABLE substance_definition ADD transfer_id INT DEFAULT NULL, CHANGE cease_of_manufacturer_ts cease_of_manufacturer_ts DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE updated_at updated_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE tonnage_band_proof_timestamp tonnage_band_proof_timestamp DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE tonnage_band_proof_approved_at tonnage_band_proof_approved_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\'');
$this->addSql('ALTER TABLE substance_definition ADD CONSTRAINT FK_282BEF2F537048AF FOREIGN KEY (transfer_id) REFERENCES legal_entity_staff_request (id)');
$this->addSql('CREATE INDEX IDX_282BEF2F537048AF ON substance_definition (transfer_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 substance_definition DROP FOREIGN KEY FK_282BEF2F537048AF');
$this->addSql('DROP INDEX IDX_282BEF2F537048AF ON substance_definition');
$this->addSql('ALTER TABLE substance_definition DROP transfer_id, CHANGE cease_of_manufacturer_ts cease_of_manufacturer_ts DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE created_at created_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE updated_at updated_at DATETIME NOT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE tonnage_band_proof_approved_at tonnage_band_proof_approved_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE tonnage_band_proof_timestamp tonnage_band_proof_timestamp DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\'');
}
}