Installing golang-migrate on Windows

Nator Verinumbe
2 min readFeb 23, 2021

--

What is golang-migrate?

golang-migrate is package/software written in golang to handle database migrations. It can be imported as a library or used as a CLI tool.

For more information, check https://github.com/golang-migrate/migrate.

1. Download the required files

Download the required files by running

go get -u -d github.com/golang-migrate/migrate/cmd/migrate

Download required files

2. Navigate to ./migrate

Navigate to the ./migrate directory using

cd $GOPATH/src/github.com/golang-migrate/migrate/cmd/migrate

(replace $GOPATH with your GOPATH, on my system it is gocode. )

change directory

To find out your GOPATH, run the following command : go env GOPATH

go path

3. check for versions available

check for the different versions ( tags ) by running

git log

check version

4. select desired version

To change to a particular version, run the command

git checkout $TAG #e.g. v4.1.0

(replace $TAG with the tag, this represents the version)

selected version

5. Install

Build and install the package, by running

go install .

go install .

The compiled binaries will be saved in your $GOPATH .

6. conclusion

Run migrate

If golang-migrate has been installed properly, you should see.

golang-migrate successfully installed

--

--

Nator Verinumbe

Not afraid of hard work, taking risks and getting broke (maybe a little nowadays). Constantly trying, learning and trying again.