yesodweb / yesodweb/persistent
Broken migrations report errors using `error`, making handling/introspection difficult
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
Sanity checking/resolution of foreign references happens at runtime when using migrateModels, unfortunately there is no explicit error handling if there is an error in the model (see:
https://github.com/yesodweb/persistent/blob/bea20181d1f70f0b01e1cb4214c422c8189626c6/persistent/Database/Persist/Sql/Internal.hs#L201).
I'm trying to debug/report where the model is broken, but I have no real way to "catch" the broken/missing table and lookup which offending model entity is referencing the missing table, which makes debugging broken models kind of a pain.
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 migrateModels and the referenced code in persistent/Database/Persist/Sql/Internal.hs around line 201, then trace how broken or missing foreign references are reported. Done should provide explicit, catchable error information that identifies the offending model entity and missing table.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100