Simple migration system for pgx.
Migrations are defined in code and are executed in order. The migration system keeps track of which migrations have been executed and which have not.
- Install the dependency
go get -u github.com/z0ne-dev/mgx/v2
- Import the package and create a new migrator
package main
import "github.com/z0ne-dev/mgx"
func main() {
migrator, _ := mgx.New(mgx.Migrations(
// insert migrations here
))
}
- Run the
Migrate(context.TODO(), pgx)
method to execute the migrations
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the Apache-2.0 License. See LICENSE
for more information.
- lopezator/migrator for inspiration for this package. Lots of inspiration was taken from this package, but it was not used directly. The API was designed to be similar, to reduce refactoring when switching between the two packages.