yesodweb / yesodweb/persistent
incorrect casing of false in `someField default=false` silently causes migrations to always happen
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
We had a splice in production like:
Persist.share [Persist.mkPersist Persist.sqlSettings, Persist.mkMigrate "migrateAll"] [Persist.persistLowerCase|
Person
isAwake Bool default=False
|]
When it came time to migrate, persistent would apply it. The next reload though, persistent would apply it again and then every run after.
If you lowercase False to false then the correct behavior happens: migration only happens once until something changes.
Postgres seems to not care about the casing here, but the check for if a migration is necessary does.
I think the correct behavior would be for either the quasiquoter to fail here for default=False or for the migration check to be case insensitive.
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 by reproducing the Persistent migration with the shown isAwake Bool default=False schema and compare it with lowercase default=false. Trace the quasiquoter and migration-checking paths to determine where casing diverges. Done means the invalid casing is rejected or equivalent casing no longer causes the migration to run repeatedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100