{"repo":"robinjoseph08/go-pg-migrations","free":true,"listed":false,"github":"https://github.com/robinjoseph08/go-pg-migrations","clone":"git clone https://github.com/robinjoseph08/go-pg-migrations.git","description":"A Go package to help write migrations with go-pg/pg.","language":"Go","stars":87,"topics":["golang","postgresql","migrations","go-pg","go"],"license":"MIT","category":"databases-storage","readme_excerpt":"go-pg-migrations A Go package to help write migrations with go-pg/pg . Usage Installation Because go-pg now has Go modules support, go-pg-migrations also has modules support; it currently depends on v10 of go-pg . To install it, use the following command in a project with a go.mod : If you are not yet using Go modules, you can still use v1 of this package. Running To see how this package is intended to be used, you can look at the example directory. All you need to do is have a main package (e.g. example ); call migrations.Run with the directory you want the migration files to be saved in (which will be the same directory of the main package, e.g. example ), an instance of pg.DB , and os.Args ; and log any potential errors that could be returned. You can also call migrations.RunWithOptions to configure the way that the migrations run (e.g. customize the name of the migration tables). Once this has been set up, then you can use the create , migrate , status , rollback , help commands like so: While this works when you have the Go toolchain installed, there might be a scenario where you have to run migrations and you don't have the toolchain available (e.g. in a scratch or alpine Docker image deployed to production). In that case, you should compile another binary (in addition to your actual application) and copy it into the final image. This will include all of your migrations and allow you to run it by overriding the command when running the Docker container. This would look ","default_branch":null,"files":null,"tree":[],"storefront":"/r/robinjoseph08","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/robinjoseph08/go-pg-migrations/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}