fix(db): RESTRICT delete of a Payment that has a FinancialBreakdown (H4)

The ledger FK used ON DELETE CASCADE on a non-nullable column, so deleting a
Payment silently destroyed its immutable financial breakdown rows. Switch to
RESTRICT — a settled payment can no longer be deleted out from under its ledger.

Regression: tests/Settlement/FinancialBreakdownIntegrityTest.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-06-28 19:10:53 +03:30
co-authored by Claude Opus 4.8
parent 7fa4b55d3f
commit d14ac38da5
4 changed files with 72 additions and 2 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ class FinancialBreakdown
private string $uuid;
#[ORM\ManyToOne(targetEntity: Payment::class)]
#[ORM\JoinColumn(name: 'payment_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
#[ORM\JoinColumn(name: 'payment_id', referencedColumnName: 'id', nullable: false, onDelete: 'RESTRICT')]
private Payment $payment;
#[ORM\Column(type: 'string', length: 20)]