I’ve been trying to set up migrations for a golang application on Heroku. I’m using native Go modules (vgo) and the official Heroku build pack. For migrations I’m using the migrate package.
The thing is, I could run migrations when the main function runs, but it feels a bit hacky, this would mean that every time the app restarts it will run the migrations. I would prefer to just run the schema migration when deploying.
I’m not sure how this can be accomplished, when I log in to the instance the go binary is not installed, it’s like the build pack only executes the main function.
I could live with doing it with a Heroku CLI command but I can’t find how to do this in the docs nor via Google.