The migrate package should support multiple database drivers, not only MySQL

Moved from GitHub dgraph/5644

Posted by johnknapp:

Experience Report

  • Running dgraph migrate on a postgres database fails.

What you wanted to do

  • I wanted a successful migration of a postgres database.
  • I wanted to specify db driver in my
  • I wanted the migrate package to load and use the correct driver

What you actually did

  • I ran dgraph migrate --config --output_schema schema.txt --output_data sql.rdf
  • I ran this on a postgres database

Why that wasn’t great, with examples

  • I received error message: driver: bad connection

Any external references to support your case

From dgraph/cmd/migrate/utils.go:32

func getPool(host, port, user, password, db string) (*sql.DB,
	error) {
	return sql.Open("mysql",
		fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?parseTime=true", user, password, host, port, db))