add ability to replace golang migration registry with custom one
I'm trying to run goose as lib for several services, and I want to run several migrations from code. Still, the issue is that we can't achieve this because multiple migrations will be registered simultaneously to the same registry. Here is some example. I have service A with go migration 0001_initial.go I have service B with go migration 0001_initial.go we import both methods to the init database, and we have a conflict.
another example I have service A with go migration 0001_initial.go I have service B with go migration 0001_somtehings.go we import both methods to the init database, and we have a conflict in versions that don't work well.
I tried to implement something very simple. We can register migrations to a custom registry and then set this registry before we run any goose code.
goose.SetMigrationsRegistry(registry)
goose.Up(...)
I believe your issue is similar to a long-outstanding one https://github.com/pressly/goose/issues/114 (relevant comment)?
If you could initialize 2 different goose providers in the same runtime would that help?
Yes that will help but I would prefer something simpler that we could leverage without breaking change.
Going to close this in favor of #625. Thanks for the PR @zmitry, sorry didn't get a chance to merge this earlier.