yesodweb / yesodweb/persistent
ToBackendKey instance not generated for custom key
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
I'm migrating from 2.8.2 to 2.13.2.1 and found that I can't use fromSqKey and toSqlKey any more, the compiler complaining that there is no ToBackendKey SqlBackend instance for the record I am using. I'm only migrating so the code works perfectly with 2.8.2.
I found out that some of my records have the ToBackendKey instance defined but some don't. I realized that all the record which I override the sql name don`t work anymore.
For example
StockAdjustment sql=fames_stock_adjustment
Id sql=stock_adj_id
comment Text
date UTCTime
status PendingStatus
user UserId
(note Id sql=stock_adj_it) There is no ToBackendKey SqlBackend StockAdjustment instance.
Is there a workaround ? I tried addiny SqlBackendKey as a type but it doesn't solve it.
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
Reproduce the migration using the supplied StockAdjustment declaration and the fromSqKey/toSqlKey calls, then inspect how the ToBackendKey SqlBackend instance is generated when a custom SQL name is used. Done means the instance is generated for this declaration and the existing conversions compile under the newer version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100