Why you need to go for the isolated database for each tenant (shop)?
I’m trying to add multi admin/shop support to the application and, seen the original database structure, it seems easier just to use one database for each shop.
What are all the advantages and disadvantages of this?
This is what I’m trying to find out. So far, so good but I didn’t see any other application dealing with multiple database and when you’re the only one you’re usually on the wrong path!
how you will achieve this technically in ROR application? How the active records will know what connection to use?
This is quite easy: using subdomains for shops I just ask AcriveRecord to connect to the ‘current’ database, basically every database is a copy of the original one, I wrote some
new rake code (and found out later that I’m not allowed to script-create database, but this is another story!)
There is only one model, ‘Installation’ that always connects to the main database and it’s used to switch between shops. I’m trying to find out if shop switch can create a mess, but
everything is okay by far…
@installation = Installation.for(request.host, request.subdomains)
…
ActiveRecord::Base.establish_connection(:adapter => “mysql”,
:host => “localhost”,
:username => “root”,
:password => “”,
:database => @installation.database)
…
see http://mek.venicebuy.eu/ and http://usul.venicebuy.eu/ are running online
Just curious to know since we are also analyzing deep in what are all
the pros and cons in using the isolated database for each tenant. We
have some thought on this design. Just curious to know what others are
thinking on this.
I wish I could see this application with heavy load and we could understand!