When working with database, schema migration is one important task that we often have to do throughout the application lifetime to adapt to new bus...
For further actions, you may consider blocking this person and/or reporting abuse
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 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 --version
commandand 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
migrator
package to write migrations using Golarapulse / migrator
MySQL 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
migrator
package, you need to install Go and set your Go workspace first.migrator
.Quick start
Initialize migrator with migration entries:
Thanks for sharing, Sergey!
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 1
and then run makefile cmd
make migrateup
it should solve this issue. Here's the docs for it
github.com/golang-migrate/migrate/...
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!
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?