-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Let database.Open() use schemeFromURL as well #271
Conversation
Otherwise it will fail on MySQL DSNs. Moved schemeFromURL into the database package. Also removed databaseSchemeFromURL and sourceSchemeFromURL as they were just calling schemeFromURL. Fixes golang-migrate#265 (comment)
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.
Thanks @lou-lan for the report and @erikdubbelboer for the fix!
var errNoScheme = errors.New("no scheme") | ||
var errEmptyURL = errors.New("URL cannot be empty") | ||
|
||
func sourceSchemeFromURL(url string) (string, error) { |
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.
Thanks for cleaning up this code! e.g. removing sourceSchemeFromURL
and databaseSchemeFromURL
FYI, builds have been fixed and I'm able to merge master into your repo/branch so I did so. Just be aware of that when you're addressing the PR comments. |
Also merged the test cases.
Pull Request Test Coverage Report for Build 521
💛 - Coveralls |
f35af21
to
7eaa808
Compare
I have no idea why the build fails, seems like it has nothing do with this change. |
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.
Thanks for adding DB tests!
database/driver_test.go
Outdated
t.Fatalf("expected %q got %q", u, md.url) | ||
} | ||
|
||
if _, err := Open("unknown://bla"); err == nil { |
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.
Make this a table driven test
migrate.go
Outdated
@@ -13,6 +13,7 @@ import ( | |||
"time" | |||
|
|||
"github.com/golang-migrate/migrate/v4/database" | |||
"github.com/golang-migrate/migrate/v4/internal/url" |
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 use the name iurl
like you did in database/driver.go
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.
Thanks for addressing my feedback!
7b55ce4
to
e3b7009
Compare
Otherwise it will fail on MySQL DSNs.
Moved schemeFromURL into the database package. Also removed databaseSchemeFromURL
and sourceSchemeFromURL as they were just calling schemeFromURL.
Fixes #265 (comment)