Installing golang-migrate on Windows
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
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.
)
To find out your GOPATH, run the following command : go env GOPATH
3. check for versions available
check for the different versions ( tags ) by running
git log
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)
5. Install
Build and install the package, by running
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.