Closed miguelmota closed 6 years ago
Found a workaround:
fsrc, err := (&file.File{}).Open("file://migrations")
if err != nil {
return err
}
m, err := migrate.NewWithInstance(
"file",
fsrc,
"postgres",
driver,
)
However, I'm getting file does not exist
after I've ran first migration successfully.
I have the same error when using cli tool, how do I import driver in cli?
solved my issue by downloading release version with curl
@Kiura how did you solve this exactly? I am having the same issue. built using:
$ go get -u -d github.com/mattes/migrate/cli github.com/go-sql-driver/mysql $ go install -tags 'mysql' github.com/mattes/migrate/cli
run using:
$ cli -database "mysql://xxx:yyy@/zzz" -source file://go/src/github.com/xxx/xxx.org/db/schema up
@nutmix I can't remember exactly how I did it back then, but try this:
curl -L https://github.com/golang-migrate/migrate/releases/download/$version/migrate.$platform-amd64.tar.gz | tar xvz
NOTE:
replace $version and $platform.
for example:
curl -L https://github.com/golang-migrate/migrate/releases/download/v3.2.0/migrate.darwin-amd64.tar.gz | tar xvz
Can't figure out why I'm getting the error
source driver: unknown driver file (forgotton import?)
.Below is my code:
The
migrations/
folder is in the same directory as the file above.Using the CLI does work for me.
Files
Any idea what I'm doing wrong in order to run migrations from the go application?
Thanks