Skip to content

fix: Improve provider apply() errors#660

Merged
mfridman merged 4 commits intomasterfrom
mf-provider-apply
Dec 10, 2023
Merged

fix: Improve provider apply() errors#660
mfridman merged 4 commits intomasterfrom
mf-provider-apply

Conversation

@mfridman
Copy link
Copy Markdown
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
@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.

1 participant