<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20220124221910 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE payment ADD invoice_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE payment ADD CONSTRAINT FK_6D28840D2989F1FD FOREIGN KEY (invoice_id) REFERENCES invoice (id)');
$this->addSql('CREATE INDEX IDX_6D28840D2989F1FD ON payment (invoice_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE payment DROP FOREIGN KEY FK_6D28840D2989F1FD');
$this->addSql('DROP INDEX IDX_6D28840D2989F1FD ON payment');
$this->addSql('ALTER TABLE payment DROP invoice_id');
}
}