yesodweb / yesodweb/persistent
SQLite deleteCascade does not handle all foreign keys
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I'm trying to use persistent-sqlite and deleteCascade with foreign keys referencing non-primary-key columns.
Here is my example program based on the reproduction template.
When I run the example, deleteCascade correctly deletes rows of tables with foreign keys that reference the username PK column. But it does not delete the rows of tables with foreign keys that reference the non-PK name column.
Is this something that should work with persistent-sqlite? My current workaround is to replace deleteCascade with multiple deleteWhere statements to take care of the related entities.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked example program and reproduce the difference between foreign keys referencing the username primary key and the non-primary-key name column. Trace how persistent-sqlite handles deleteCascade for those cases, then verify that related rows are deleted for both references without relying on multiple deleteWhere statements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell, sqlite
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100