Please use go install github.com/golang-migrate/migrate/v4 and add go’s bin directory to your PATH. Using brew for a go package doesn’t sound like a good idea, considering version differences
I am on windows and did this, like ran this command on the terminal, it ran and installed it and said package is not a main package
then i ran the migrate --version command
and its not able to find it like not installed or something, confused with gobin and gopath.
MySQL database migrator designed to run migrations to your features and manage database schema update with intuitive go code. It is compatible with the latest MySQL v8.
Installation
To install migrator package, you need to install Go and set your Go workspace first.
The first need Go installed (version 1.13+ is required), then you can use the below Go command to install migrator.
We believe that everyone deserves a good and free education. The purpose of Tech School is to give everyone a chance to learn IT by giving free, high-quality tutorials and coding courses.
when i type run make migratedown in terminal i am getting following error:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Hola, I am a senior software engineer with over 7+ years of experience in software engineering and development. I have been working on Golang, Node.js, Typescript, AWS, and GCP.
We believe that everyone deserves a good and free education. The purpose of Tech School is to give everyone a chance to learn IT by giving free, high-quality tutorials and coding courses.
Hi Mori, please check out lecture 4 and 5 of this series. You will see how to generate codes to insert data to the database, and also how to generate random data for seeding or testing.
Please use
go install github.com/golang-migrate/migrate/v4and add go’s bin directory to your PATH. Using brew for a go package doesn’t sound like a good idea, considering version differencesI am on windows and did this, like ran this command on the terminal, it ran and installed it and said package is not a main package
then i ran the
migrate --versioncommandand its not able to find it like not installed or something, confused with gobin and gopath.
I think your first problem is that you’re running Windows but further you might want to add your ~/go/bin directory to your PATH env in bashrc
cant stress this one enough
You can also try using
migratorpackage to write migrations using GoMySQL database migrator
MySQL database migrator
MySQL database migrator designed to run migrations to your features and manage database schema update with intuitive go code. It is compatible with the latest MySQL v8.
Installation
To install
migratorpackage, you need to install Go and set your Go workspace first.migrator.Quick start
Initialize migrator with migration entries:
Thanks for sharing, Sergey!
try github.com/covrom/goerd
when i type run make migratedown in terminal i am getting following error:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
I am not getting the issue!
Getting this error while migratedown
"Dirty database version -1. Fix and force version."
can anyone help with a solution! it will be a great help if you can.
Hi Apoorv, try this cmd first
migrate -path db/migration -database "postgresql://root:secret@localhost:5432/simple_bank?sslmode=disable" force 1and then run makefile cmd
make migrateupit should solve this issue. Here's the docs for it
github.com/golang-migrate/migrate/...
How do I seed the DB in this example?
Hi Mori, please check out lecture 4 and 5 of this series. You will see how to generate codes to insert data to the database, and also how to generate random data for seeding or testing.
Thank you
There is probably error on the orange picture "MIGRATE DOWN" - files shown there should be ...down.sql not ...up.sql
Right?