<?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 Version20200319124812 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 non_member_order_invoice ADD billing_company_id INT DEFAULT NULL, ADD billing_contact_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE non_member_order_invoice ADD CONSTRAINT FK_987BEE981BFC7547 FOREIGN KEY (billing_company_id) REFERENCES non_member_billing_company (id)');
$this->addSql('ALTER TABLE non_member_order_invoice ADD CONSTRAINT FK_987BEE986BC64ADB FOREIGN KEY (billing_contact_id) REFERENCES non_member_billing_contact_person (id)');
$this->addSql('CREATE INDEX IDX_987BEE981BFC7547 ON non_member_order_invoice (billing_company_id)');
$this->addSql('CREATE INDEX IDX_987BEE986BC64ADB ON non_member_order_invoice (billing_contact_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 non_member_order_invoice DROP FOREIGN KEY FK_987BEE981BFC7547');
$this->addSql('ALTER TABLE non_member_order_invoice DROP FOREIGN KEY FK_987BEE986BC64ADB');
$this->addSql('DROP INDEX IDX_987BEE981BFC7547 ON non_member_order_invoice');
$this->addSql('DROP INDEX IDX_987BEE986BC64ADB ON non_member_order_invoice');
$this->addSql('ALTER TABLE non_member_order_invoice DROP billing_company_id, DROP billing_contact_id');
}
}