yesodweb / yesodweb/persistent
Postgres sqltype=varchar(n) causes remigration
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
If I have an existing database and put in the model:
column Text Maybe sqltype=varchar(31)
it will cause Persistent to remigrate every run because it doesn't seem to recognize that it is the same as the existing type. Fixing it with:
column Text Maybe maxlen=31
is great and is the real fix, but it is very difficult to track this down and both should be the same thing and interchangeable. This can cause a failed migration when the column is part of a View in the db, for instance, and so altering the column type causes an sql error.
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 behavior with a PostgreSQL column declared as sqltype=varchar(31), then compare it with maxlen=31. Trace the schema type comparison and migration path; done means equivalent declarations no longer trigger remigration, including for columns used by a database view.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100