Support declaring Maybe before the type in model definitions#1264
Merged
parsonsmatt merged 16 commits intoyesodweb:matt/maybe-before-typefrom Jun 29, 2021
Merged
Conversation
parsonsmatt
requested changes
May 6, 2021
Collaborator
parsonsmatt
left a comment
There was a problem hiding this comment.
Let's write a test in persistent-test that'll be run on the various backends and ensure that migrations are getting handled correctly.
I expect that they are, but it's good to double check :)
persistent/Database/Persist/Quasi.hs
Outdated
| > nullableField Int nullable | ||
|
|
||
| However the difference here is in the first instance the Haskell type will be 'Maybe Int', | ||
| but in the second it will be 'Int'. |
Collaborator
There was a problem hiding this comment.
Should add a note that this will cause runtime errors if the database returns NULL and the PersistField instance for the type in question doesn't handle PersistNull.
| > TableName | ||
| > fieldName FieldType | ||
| > otherField String | ||
| > nullableField (Maybe Int) |
| SharedPrimaryKeySpec.spec | ||
| SharedPrimaryKeyImportedSpec.spec | ||
| ImplicitIdColSpec.spec | ||
| MaybeFieldDefsSpec.spec |
Collaborator
There was a problem hiding this comment.
okay awesome
This is testing that the TH generation does the right thing for the Haskell side
Collaborator
|
CI is fixed on master |
8414bc5 to
3de32af
Compare
36a8a11 to
9fac010
Compare
9fac010 to
b6a9c9b
Compare
parsonsmatt
approved these changes
May 24, 2021
Collaborator
|
Ah, now we're failing because of MongoDB. I'm going to merge this into a branch and finish it. Thanks so much, and sorry it took me so long to review! |
7 tasks
parsonsmatt
added a commit
that referenced
this pull request
Jun 29, 2021
* Support declaring Maybe before the type in model definitions (#1264) * Add missing type sigs * Extract/dry up is nullable * Extract/rename associateComments function * Implement a way of detecting Maybe field defs * Fixing warnings * Add a spec * Add documentation * Add PR reference to changelog * Add a test to cover the various backends * Also test mongo * Fix test compilation issues * Update readme Co-authored-by: Matt Parsons <[email protected]> * gotta fix that Co-authored-by: Dan Brooks <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before submitting your PR, check that you've:
@sincedeclarations to the Haddockstylish-haskellon any changed files..editorconfigfile for details)After submitting your PR:
(unreleased)on the ChangelogCloses #277