-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve documentation around migration safety #1277
Improve documentation around migration safety #1277
Conversation
I've discovered this fixes an issue, so I'll add that into the PR message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -200,7 +200,7 @@ addMigration | |||
-> Sql | |||
-- ^ 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)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <parsonsmatt@gmail.com>
e068fc3
to
e5f08c3
Compare
looks great! |
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 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
Bool
value. 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:
@since
declarations to the Haddockstylish-haskell
on any changed files..editorconfig
file for details)After submitting your PR:
(unreleased)
on the Changelog