-
Notifications
You must be signed in to change notification settings - Fork 516
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
[WIP] - Adding a provider #378
Conversation
b.WriteString("\t" + name + "\n") | ||
} | ||
b.WriteString("\n") | ||
b.WriteString("go functions must be registered and built into a custom binary see:\nhttps://github.com/pressly/goose/tree/master/examples/go-migrations") |
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.
In the existing implementation, we did a "is registered" check in the *Migration.run
function.
I think this is too late. Instead, we should fail much earlier when initializing the provider.
What we want to avoid is applying 3 migrations and potentially failing on the 4th if the file was not registered.
This isn't a breaking change per se, the end result is still a failure in both cases. But doing it earlier is safer.
This PR will be superseded by #484 |
I don't intend to merge this branch, simply putting up a PR to show where my thinking is at.
This may be done in a backwards-compatible way, since the entry point to a well-defined struct is
goose.NewProvider
.I'll go into more detail (eventually), but the summary is:
Provider
struct that can be initizlied independently. No more global state, allowing multiple providers per runtimecontext.Context
*sql.DB
and use whatever driver they want, they just have to match it to one of the supported dialects*sql.DB