migrate icon indicating copy to clipboard operation
migrate copied to clipboard

Return a new instance of Driver from registry's GetDriver() function

Open bradley219 opened this issue 8 years ago • 3 comments

I've found that concurrent migrations on multiple schema are not possible due to the fact that GetDriver() returns a Driver singleton for all named drivers. There are definitely more sound ways to solve this (i.e. registering a factory method to create a customized new instance of Driver), but given the simplicity of the current design, I've opted to just create and return a new instance of Driver from GetDriver() by using the reflect package.

I've tested this using the MySQL driver specifically and am now able to run concurrent migrations on any number of unique database URLs.

bradley219 avatar Apr 04 '17 20:04 bradley219

Not sure off the top of my head how to deal with the test failures involving RegisterMethodsReceiverForDriver()—this came as a surprise just now. If you have any ideas please let me know :)

bradley219 avatar Apr 04 '17 20:04 bradley219

Sorry for the delay. Was out for conferences last week in SF.

I fixed this in v3. Would you mind checking that version out and see if it suits your use-case?

mattes avatar Apr 10 '17 18:04 mattes

Would you mind changing the target branch to v1 ?

mattes avatar Apr 20 '17 22:04 mattes