<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240222192521 extends AbstractMigration
{
public function getDescription(): string
{
return 'Revert some FK constraints to allow nulls again';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE payment_intents DROP FOREIGN KEY FK_68498DE85AA1164F');
$this->addSql('ALTER TABLE payment_intents DROP FOREIGN KEY FK_68498DE8514A7680');
$this->addSql('ALTER TABLE payment_intents ADD CONSTRAINT FK_68498DE85AA1164F FOREIGN KEY (payment_method_id) REFERENCES payment_methods (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE payment_intents ADD CONSTRAINT FK_68498DE8514A7680 FOREIGN KEY (payment_processor_id) REFERENCES payment_processors (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE sms_intents DROP FOREIGN KEY FK_811A48D8514A7680');
$this->addSql('ALTER TABLE sms_intents ADD CONSTRAINT FK_811A48D8514A7680 FOREIGN KEY (payment_processor_id) REFERENCES payment_processors (id) ON DELETE SET NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE payment_intents DROP FOREIGN KEY FK_68498DE8514A7680');
$this->addSql('ALTER TABLE payment_intents DROP FOREIGN KEY FK_68498DE85AA1164F');
$this->addSql('ALTER TABLE payment_intents ADD CONSTRAINT FK_68498DE8514A7680 FOREIGN KEY (payment_processor_id) REFERENCES payment_processors (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('ALTER TABLE payment_intents ADD CONSTRAINT FK_68498DE85AA1164F FOREIGN KEY (payment_method_id) REFERENCES payment_methods (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('ALTER TABLE sms_intents DROP FOREIGN KEY FK_811A48D8514A7680');
$this->addSql('ALTER TABLE sms_intents ADD CONSTRAINT FK_811A48D8514A7680 FOREIGN KEY (payment_processor_id) REFERENCES payment_processors (id) ON UPDATE NO ACTION ON DELETE CASCADE');
}
}