customink / secondbase

Seamless second database integration for Rails.
MIT License
220 stars 30 forks source link

What about ThirdBase? #41

Closed stevenharman closed 7 years ago

stevenharman commented 7 years ago

I'm not trolling. Really. I have inherited an app which has THREE (3) different DBs. The primary is MySQL. And then there are two different PostreSQL DBs used for metrics and some-other-thing-I-don't-yet-fully-understand. The point being, we need to manage 3 different DBs. The current "solution" for that is manually creating various DBs, running migrations for those other DBs from the main migrations, etc... It's a Bad Time™.

I'd like to use SecondBase, but we have that darned ThirdBase too. How tied to only two DBs is this Gem? Would adding support for a third (or arbitrary number, I suppose) be totally absurd?

metaskills commented 7 years ago

Love it! We have talked about 3rd base before. Technically we could step and repeat all the things that made this work. I do wonder if you need a true 3rd base tho. Does that "some-other-thing-I-don't-yet-fully-understand" DB require a schema and full participation in the rake tasks? If not, then a good ol' fashion abstract connection class would work. See: https://gist.github.com/metaskills/4065702

If it does need full database task support, then we would have to go with extending SecondBase which may be just fork it and rename everything :)

metaskills commented 7 years ago

Wow! Someone did it a few months ago: https://github.com/sagittaros/thirdbase

hmadison commented 7 years ago

I ended up prototyping this at one point and pulled back from it. Without some major changes landed in Rails core, you end up having to metaprogram almost everything in the gem to support an n number of databases. This turns into an unintelligible mess very fast, and is impossible to debug.

I feel you have three options here:

karledurante commented 7 years ago

You might also want to look into the Octopus Gem.

jomei commented 7 years ago

Please, check out my solution

metaskills commented 7 years ago

@jomei Thanks for posting! I made an issue on your repo to sort out the LICENSE issue. Cheers. https://github.com/jomei/multibase/issues/1

shqear93 commented 4 years ago

@metaskills does this feature implemented in secondbase already ?

metaskills commented 4 years ago

Oh no... if you need a third, fork and rename :)