In relational databases, deletion is notoriously fraught.
In financial software, deletion is outright dangerous.
When a user taps "Delete" on a personal loan record, what should happen behind the scenes?
Should the database delete the loan agreement?
What happens to the three partial repayments logged over the past six months?
What happens to the companion bank statement transactions where those repayments deposited money into the user's checking account?
If the user deletes a bank transaction directly from their transaction feed, does the debt tracker know that a repayment was reversed?
If you rely solely on SQLite's built-in ON DELETE CASCADE , you will inevitably cause orphaned financial records and silent balance drift .
Here is how FinLedger architected a coordinated, multi-entity cascading deletion engine ( LendingRepository.kt , commit 220a5fa ) that maintains absolute mathematical integrity across interconnected tables.
The Danger of Naive Cascades
Consider what happens when database tables…