rubenv / sql-migrate

SQL schema migration tool for Go.
MIT License
3.16k stars 269 forks source link

Migrate transactions for multiple shards #246

Open musinit opened 1 year ago

musinit commented 1 year ago

It would be nice to support multiple hosts for migration, so it's possible to apply migration for sharded databases.

musinit commented 1 year ago

@rubenv what do you think? :) I can suggest the MR

rubenv commented 1 year ago

How will that impact existing users?

musinit commented 1 year ago

I would make this feature optional, so no impact on those who don't need it

rubenv commented 1 year ago

What would we need to add/change?

The thing I'm trying to evaluate is whether this should be part of sql-migrate, or part of something that uses sql-migrate as a building block.

musinit commented 1 year ago

What if we do it the same way, as multihost connection string works? datasource: postgresql://node1:port1,postgresql://node2:port2

than would allow multihosting for master/slave PG migrations + can work the same way for all shards. I am not sure that it's good to mix multihost connection string with different shards, maybe it's better to implement it with separate config option, like datasources: source1, source2, ...