riverqueue / river

Fast and reliable background jobs in Go
https://riverqueue.com
Mozilla Public License 2.0
3.51k stars 94 forks source link

[Feature request] Programatic migration #539

Closed nexovec closed 2 months ago

nexovec commented 2 months ago

Hi, I'd really like a way to do river migrate-up programatically in go. This would allow me to smoothly react to failing migrations and have more control over the process. There is currently no mention of this in the docs, but maybe it's already possible, since the CLI can do it?

nexovec commented 2 months ago

I know I can just fork the process, but that's really ugly.

nexovec commented 2 months ago

This was partially motivated by river CLI somehow failing to install

go install github.com/riverqueue/river/cmd/river@latest
# github.com/riverqueue/river
/root/go/pkg/mod/github.com/riverqueue/river@v0.11.3/client.go:481:27: undefined: baseservice.NewArchetype
/root/go/pkg/mod/github.com/riverqueue/river@v0.11.3/client.go:659:30: c.baseStartStop.StoppedUnsafe undefined (type startstop.BaseStartStop has no field or method StoppedUnsafe)
/root/go/pkg/mod/github.com/riverqueue/river@v0.11.3/client.go:720:23: undefined: startstop.StartAll

(Issue #538 )

brandur commented 2 months ago

Check out the Go migrations API:

https://riverqueue.com/docs/migrations#go-migration-api