migrations/2026/06/Version20260603120000.php line 1

  1. <?php
  2. declare(strict_types=1);
  3. /**
  4.  * Copyright (c) 2026 TECLA Consulting Group oü.
  5.  * All rights reserved.
  6.  *
  7.  * This unpublished material is proprietary to TECLA Consulting Group oü.
  8.  * All rights reserved. The methods and
  9.  * techniques described herein are considered trade secrets
  10.  * and/or confidential. Reproduction or distribution, in whole
  11.  * or in part, is forbidden except by express written permission
  12.  * of TECLA Consulting Group oü.
  13.  *
  14.  * @author    Narendra Srivastava <nsrivastava2@velsof.com>
  15.  * @copyright 2026 TECLA Consulting Group oü
  16.  */
  17. namespace DoctrineMigrations;
  18. use Doctrine\DBAL\Schema\Schema;
  19. use Doctrine\Migrations\AbstractMigration;
  20. /**
  21.  * Adds approver-audit columns to invoice_repeat_rule_occurrence.
  22.  *
  23.  * issued_by_id: the contact who approved (issued) the system-generated draft.
  24.  * issued_at:    timestamp when the draft was approved.
  25.  *
  26.  * Both columns are NULLABLE and additive — the running dev site is unaffected.
  27.  */
  28. final class Version20260603120000 extends AbstractMigration
  29. {
  30.     public function getDescription(): string
  31.     {
  32.         return 'Add issued_by_id (contact FK) and issued_at columns to invoice_repeat_rule_occurrence for approver-audit trail. Additive/nullable only.';
  33.     }
  34.     public function up(Schema $schema): void
  35.     {
  36.         $this->addSql('ALTER TABLE invoice_repeat_rule_occurrence ADD issued_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:contact_id)\', ADD issued_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
  37.         $this->addSql('ALTER TABLE invoice_repeat_rule_occurrence ADD INDEX IDX_162C0FFC784BB717 (issued_by_id)');
  38.         $this->addSql('ALTER TABLE invoice_repeat_rule_occurrence ADD CONSTRAINT FK_162C0FFC784BB717 FOREIGN KEY (issued_by_id) REFERENCES contact (id)');
  39.     }
  40.     public function down(Schema $schema): void
  41.     {
  42.         $this->addSql('ALTER TABLE invoice_repeat_rule_occurrence DROP FOREIGN KEY FK_162C0FFC784BB717');
  43.         $this->addSql('ALTER TABLE invoice_repeat_rule_occurrence DROP INDEX IDX_162C0FFC784BB717');
  44.         $this->addSql('ALTER TABLE invoice_repeat_rule_occurrence DROP COLUMN issued_by_id, DROP COLUMN issued_at');
  45.     }
  46. }