Skip to content
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

fix: Improve provider apply() errors #660

Merged
merged 4 commits into from
Dec 10, 2023
Merged

fix: Improve provider apply() errors #660

merged 4 commits into from
Dec 10, 2023

Conversation

mfridman
Copy link
Collaborator

@mfridman mfridman commented Dec 10, 2023

This PR adds a new error ErrNotApplied, that is returned from *provider.Apply() when trying to rollback a migration that has not been previously applied.

This makes it consistent with the up direction, which also returns an error (ErrAlreadyApplied) when trying to apply a migration that has previously been applied.

This set of comments aims to capture this behaviour:

//  1. direction is up
//    a. migration is applied, this is an error (ErrAlreadyApplied)
//    b. migration is not applied, apply it
//  2. direction is down
//    a. migration is applied, rollback
//    b. migration is not applied, this is an error (ErrNotApplied)

@mfridman mfridman changed the title Improve provider apply errors fix: Improve provider apply errors Dec 10, 2023
@mfridman mfridman changed the title fix: Improve provider apply errors fix: Improve provider apply() errors Dec 10, 2023
@mfridman mfridman merged commit 31709a3 into master Dec 10, 2023
9 checks passed
@mfridman mfridman deleted the mf-provider-apply branch December 10, 2023 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant