migrations/Version20251123000000.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Adds payment.sales_return_id to link refunds/mahsuplaşma kayıtları ile iade kaydı.
  8.  */
  9. final class Version20251123000000 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Add nullable sales_return_id FK to payment for refund linkage';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $this->addSql('ALTER TABLE payment ADD sales_return_id INT DEFAULT NULL');
  18.         $this->addSql('ALTER TABLE payment ADD CONSTRAINT FK_6D28840D577C93D2 FOREIGN KEY (sales_return_id) REFERENCES sales_return (id) ON DELETE SET NULL');
  19.         $this->addSql('CREATE INDEX IDX_6D28840D577C93D2 ON payment (sales_return_id)');
  20.     }
  21.     public function down(Schema $schema): void
  22.     {
  23.         $this->addSql('ALTER TABLE payment DROP FOREIGN KEY FK_6D28840D577C93D2');
  24.         $this->addSql('DROP INDEX IDX_6D28840D577C93D2 ON payment');
  25.         $this->addSql('ALTER TABLE payment DROP sales_return_id');
  26.     }
  27. }