yogthos / migratus

MIGRATE ALL THE THINGS!
642 stars 93 forks source link

Suggestion: Allow passing in a connection #171

Closed snorremd closed 5 years ago

snorremd commented 5 years ago

Would it make sense to pass in an existing connection instance to migratus instead of specifying a db connection map?

Ref: https://github.com/yogthos/migratus/issues/90#issuecomment-250065862

I use a Hikari connection pool in a project and have logic to configure and create db connections already. It would be nice if that logic could be reused when dealing with migrations. As far as I can tell this feature would only require small modifications of the connect* function. The function could check if db is an instance of a connection, or contains a :connection key and if so forgo creating the connection.

yogthos commented 5 years ago

That sounds reasonable to me, would you be up for doing a PR to add that? :)

snorremd commented 5 years ago

Sure thing.

yogthos commented 5 years ago

👍

snorremd commented 5 years ago

Solved as of #172.