<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Adds payment.sales_return_id to link refunds/mahsuplaşma kayıtları ile iade kaydı.
*/
final class Version20251123000000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add nullable sales_return_id FK to payment for refund linkage';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE payment ADD sales_return_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE payment ADD CONSTRAINT FK_6D28840D577C93D2 FOREIGN KEY (sales_return_id) REFERENCES sales_return (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_6D28840D577C93D2 ON payment (sales_return_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE payment DROP FOREIGN KEY FK_6D28840D577C93D2');
$this->addSql('DROP INDEX IDX_6D28840D577C93D2 ON payment');
$this->addSql('ALTER TABLE payment DROP sales_return_id');
}
}