yesodweb / yesodweb/persistent

`SqlOther "GEOGRAPH(POINT,4326)` gets re-migrated every time migrateAll is called

Open
#815 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
486
Forks
306
PR merge metrics
No merged PRs in 30d

Description

I created the following postgis type and made it persistent compatible.

data GeoPoint = ...

instance PersistField GeoPoint where
    ...

instance PersistFieldSql GeoPoint where
    sqlType _ = SqlOther "GEOGRAPHY(POINT,4326)"

It seems to work ok, however for whatever reason it seems to re-migrate every column that uses it every time migrateAll is called, even though after the first time it should be a no-op / it should be detected as equal and not in need of migration.

Specifically I get:

Migrating: ALTER TABLE "geo_test" ALTER COLUMN "geopoint_test" TYPE GEOGRAPHY(POINT,4326)
[Debug#SQL] ALTER TABLE "geo_test" ALTER COLUMN "geopoint_test" TYPE GEOGRAPHY(POINT,4326); []

Every time.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the shown GeoPoint PersistField and PersistFieldSql instances, then trace migrateAll's comparison of the SqlOther "GEOGRAPHY(POINT,4326)" type. The fix is complete when the first migration applies the ALTER TABLE and a subsequent migrateAll call treats the column as unchanged.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.