<?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 Version20201214152226 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 legal_entity_staff_request ADD old_entity_invoice_id INT DEFAULT NULL, CHANGE handled_at handled_at 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 assigned_at assigned_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE file_timestamp file_timestamp DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE echa_date echa_date DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE invoice_id new_entity_invoice_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE legal_entity_staff_request ADD CONSTRAINT FK_A6596A497705316B FOREIGN KEY (new_entity_invoice_id) REFERENCES legal_entity_order_invoice (id)');
$this->addSql('ALTER TABLE legal_entity_staff_request ADD CONSTRAINT FK_A6596A49A077E2A2 FOREIGN KEY (old_entity_invoice_id) REFERENCES legal_entity_order_invoice (id)');
$this->addSql('CREATE INDEX IDX_A6596A497705316B ON legal_entity_staff_request (new_entity_invoice_id)');
$this->addSql('CREATE INDEX IDX_A6596A49A077E2A2 ON legal_entity_staff_request (old_entity_invoice_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_staff_request DROP FOREIGN KEY FK_A6596A497705316B');
$this->addSql('ALTER TABLE legal_entity_staff_request DROP FOREIGN KEY FK_A6596A49A077E2A2');
$this->addSql('DROP INDEX IDX_A6596A497705316B ON legal_entity_staff_request');
$this->addSql('DROP INDEX IDX_A6596A49A077E2A2 ON legal_entity_staff_request');
$this->addSql('ALTER TABLE legal_entity_staff_request ADD invoice_id INT DEFAULT NULL, DROP new_entity_invoice_id, DROP old_entity_invoice_id, CHANGE handled_at handled_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE assigned_at assigned_at 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 echa_date echa_date DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\', CHANGE file_timestamp file_timestamp DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\'');
$this->addSql('ALTER TABLE legal_entity_staff_request ADD CONSTRAINT FK_A6596A492989F1FD FOREIGN KEY (invoice_id) REFERENCES legal_entity_order_invoice (id)');
$this->addSql('CREATE INDEX IDX_A6596A492989F1FD ON legal_entity_staff_request (invoice_id)');
}
}