rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.18k stars 270 forks source link

"sql-migrate" is not recognized as an internal or external command, executable program or batch file. #183

Open LuisAngelLucerosaldanaD opened 3 years ago

LuisAngelLucerosaldanaD commented 3 years ago

i'm programing in windows and when I execute answer me with "sql-migrate" is not recognized as an internal or external command, executable program or batch file. how should I set the environment variable in windows?

bbkane commented 3 years ago

I can't test this (I'm on a Mac), but try the following:

Get GOPATH:

go env GOPATH

You should be able to open the folder listed and see a folder called bin. Check that sql-migrate (or maybe sql-migrate.exe is in the bin folder. If it's not there, you most likely didn't install it correctly.

Add the full path to the bin folder (I'm on MacOS, so my path looks like /Users/bbkane/go/bin -ou're on Windows, so yours will look different) to your PATH environmental variable with these instructions

Landon345 commented 2 years ago

Even on my Mac, I was running into this issue. For me, since I use zsh for my terminal, I had to run:

code ~/.zshrc

Then put this line in the file:

export PATH="$PATH:/Users/landonschlangen/go/bin"

Once I did so, the sql-migrate command finally started working.

vmato commented 2 years ago

On windows go get does not provide executable.

Build requires gcc which usually is not installed