mysql scheme fix

This commit is contained in:
mattes 2014-10-17 11:34:43 -07:00
parent bbc885c280
commit 7b1a07fa97
1 changed files with 6 additions and 1 deletions

View File

@ -22,7 +22,12 @@ type Driver struct {
const tableName = "schema_migrations"
func (driver *Driver) Initialize(url string) error {
db, err := sql.Open("mysql", strings.TrimLeft(url, "mysql://"))
urlWithoutScheme := strings.SplitN(url, "mysql://", 2)
if len(urlWithoutScheme) != 2 {
return errors.New("invalid mysql:// scheme")
}
db, err := sql.Open("mysql", urlWithoutScheme[1])
if err != nil {
return err
}