I built this to use in my own projects so I thought I would share it for everyone to use.
- Create and manage database migrations
- Create migrations up/down files
- Apply/rollback migrations
- Show user all applied migrations
$ go install github.com/grqphical/gomigrate@latest
To start make sure you have an environment variable or .env variable with DATABASE_URL
defined.
Then run gomigrate init
to create the migrations directory and setup the migrations table in the database
Next, run gomigrate create NAME
to create a new migration
Then finally, run gomigrate up
to apply the migration to your database
If you wish to rollback the database to a clean slate, use gomigrate down
gomigrate is released under the MIT License