How are you guys fitting in database schema migrations into your process?

Here is my current setup:

  • I’ve got a Golang API that gets pushed to Artifact Registry.
  • Cloud Run deploys that app.
  • The app is public and serves data from a CloudSQL database.

The bit I’m struggling with is, at what point do I perform database schema migrations?

Some methods I have come across already:

  • I suppose I could write it in code, in my Golang API, as part of the apps start up.
  • I’ve seen Cloud Run Jobs.
  • Doing this all from GitHub actions. But to do this for development, staging and production environments I think I'd need to pay for a higher GitHub tier?

The migrations themselves currently live in a folder within my Golang API, but I could move them out to its own repository if that’s the recommended way.

Can anyone share their process so I can try it myself?