golang-migrate: Command line tool used to easily create versioned migration files
brew install golang-migrate
go-bindata: Binary packing tool so .sql migration files can be built into the deployed go binary
go get -u github.com/go-bindata/go-bindata/...
In order to add new files to the database/migrations directory which are automatically named in conformance with the migration sequence numbers, run the below from the root dir of the project.
migrate create -ext sql -dir database/migrations -seq $MIGRATION_NAME
With golang-migrate installed on your machine and access to the postgres database run the following to clear out the dirty state so you can run migrations again.
migrate -path database/migrations -database "postgres://edyn:[email protected]/edyn?sslmode=disable" force $LASTGOODVERSION
This manually runs a migration so the error messages can be more easily checked in the case of a failed migration. This is equivalent to the migration step that is run internally when a new version is deployed through CI/CD
migrate -path database/migrations -database "postgres://edyn:[email protected]/edyn?sslmode=disable" up