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:
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user