Command line tool for PostgreSQL migrations
- Runs migrations in transactions (one transaction per one migration file).
- Stores migration version details in auto-generated table
schema_migrations
.
migrate -path ./db/migrations create add_field_to_table
migrate -url postgres://user@host:port/database -path ./db/migrations -timeout 10 up
migrate -url postgres://user@host:port/database -path ./db/migrations -timeout 10 up 1
migrate -url postgres://user@host:port/database -path ./db/migrations -timeout 10 down
migrate -url postgres://user@host:port/database -path ./db/migrations -timeout 10 down 1
migrate help # for more info
Install golangci-lint with
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint github.com/securego/gosec/cmd/gosec
- Fork the repo on Github.
- Clone the
wallester/migrate
repo. Next steps are to be done in thewallester/migrate repo
(not the fork). - Add your fork as a new remote (
git remote add myfork url-of-myfork
). - Create a new branch, do your work and commit the changes as usual.
- Push your new branch to your fork (
git push myfork mybranch
). - Open a pull request in Github as usual.