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

Let database.Open() use schemeFromURL as well #271

Merged
merged 5 commits into from
Aug 20, 2019

Conversation

erikdubbelboer
Copy link
Contributor

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)

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)
Copy link
Member

@dhui dhui left a 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!

database/util_test.go Outdated Show resolved Hide resolved
database/util.go Outdated Show resolved Hide resolved
var errNoScheme = errors.New("no scheme")
var errEmptyURL = errors.New("URL cannot be empty")

func sourceSchemeFromURL(url string) (string, error) {
Copy link
Member

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

@dhui
Copy link
Member

dhui commented Aug 19, 2019

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

coveralls commented Aug 19, 2019

Pull Request Test Coverage Report for Build 521

  • 18 of 19 (94.74%) changed or added relevant lines in 3 files are covered.
  • 53 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.3%) to 51.277%

Changes Missing Coverage Covered Lines Changed/Added Lines %
database/driver.go 3 4 75.0%
Files with Coverage Reduction New Missed Lines %
testing/docker.go 53 1.53%
Totals Coverage Status
Change from base Build 514: 0.3%
Covered Lines: 2329
Relevant Lines: 4542

💛 - Coveralls

@erikdubbelboer
Copy link
Contributor Author

I have no idea why the build fails, seems like it has nothing do with this change.

Copy link
Member

@dhui dhui left a 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!

t.Fatalf("expected %q got %q", u, md.url)
}

if _, err := Open("unknown://bla"); err == nil {
Copy link
Member

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"
Copy link
Member

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

Copy link
Member

@dhui dhui left a 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!

database/driver_test.go Outdated Show resolved Hide resolved
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.

3 participants