yesodweb / yesodweb/persistent

Support for views

Open
#1,368 0 comments 5 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

Declaring views just as regular tables almost works.

However the auto derived migrations get fairly messed up. Of course initially suggesting creating a new table, but more importantly even after you create the view, persistent tries to SET NOT NULL all the non-null columns, which of course fails if you try it.

Additionally it would be nice to prevent inserts/updates in the case of more complex views where such a thing is not supported. Perhaps something as simple as letting you declare if the view is read-only or read-write, rather than trying to derive that information.

Working without view tables seems to make it almost impossible to do interesting changes to existing tables while keeping a reasonably long backwards compatibility window, forcing annoying strategies like micro migrations combined with frequent production server restarts. However as it stands using them heavily to avoid that would make persistent migrations very noisy and increase the risk of type checking but incorrect code.

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

No files or tests are named. Start by tracing auto-derived migrations and how view tables are represented, then determine how read-only versus read-write views should affect schema changes and writes. Done means view declarations no longer produce invalid table migrations or unsupported write operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.