yesodweb / yesodweb/persistent

RFC: Should MigrationOnly indicate nullability?

Open
#918 6 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

Currently, using MigrationOnly on a column will omit the field from the Haskell datatype but the resulting SQL is still intact.

This means if you do an insert on a record with a non-nullable (and no default) MigrationOnly column that it will fail at runtime with a "missing value" error.

You can fix this by doing field FieldType Maybe MigrationOnly. Should MigrationOnly imply Maybe?

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 how MigrationOnly columns affect generated Haskell record fields, SQL schemas, and inserts, comparing the non-nullable case with an explicit Maybe field. Done requires a maintainer decision on whether MigrationOnly should imply Maybe and agreement on the resulting insert behavior.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.