Improve documentation around migration safety#1277
Merged
parsonsmatt merged 5 commits intoyesodweb:masterfrom Jun 23, 2021
Merged
Improve documentation around migration safety#1277parsonsmatt merged 5 commits intoyesodweb:masterfrom
parsonsmatt merged 5 commits intoyesodweb:masterfrom
Conversation
Contributor
Author
|
I've discovered this fixes an issue, so I'll add that into the PR message. |
parsonsmatt
requested changes
Jun 18, 2021
Collaborator
parsonsmatt
left a comment
There was a problem hiding this comment.
Let's make this a documentation change instead of a behavior change. That way we can release it as a patch fix. If we're changing behavior, that'd need to be in a major version bump.
| -- ^ A 'Text' value representing the command to run on the database. | ||
| -> Migration | ||
| addMigration isSafe sql = lift (tell [(isSafe, sql)]) | ||
| addMigration isSafe sql = lift (tell [(not isSafe, sql)]) |
Collaborator
There was a problem hiding this comment.
This would be a breaking change in behavior. Let's instead change the documentation? That way, we won't break any existing code, and folks writing new code will be able to tell from the docs how to do it right.
Contributor
Author
There was a problem hiding this comment.
This is done now.
The Haddocks around CautiousMigration were ambiguous, since it wasn't clear if the flag signified whether each migration was safe or not - and there is at least one instance in the code that gets it wrong. This corrects that error, opting to make the `addMigration` documentation match the actual behaviour of the code.
Co-authored-by: Matt Parsons <[email protected]>
e068fc3 to
e5f08c3
Compare
Collaborator
|
looks great! |
parsonsmatt
approved these changes
Jun 23, 2021
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.
The Haddocks around CautiousMigration were ambiguous, since it wasn't clear if the flag signified whether each migration was safe or not - and there is at least one instance in the code that gets it wrong.
This corrects that error, opting to make the
addMigrationdocumentation match the code's behaviour.Personally, I think the better approach to this mess would be to replace all the use of
(Bool, Text)with a datatype that enforces better usage through a stricter API - something likeThat way consumers could not be misled about the nature of the
Boolvalue. But I thought that would be quite drastic and breaking, so I didn't want to make it my first suggestion.Fixes #1081.
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 Changelog