Topic: How to model multiple tables with same schema
I'm trying to convert an old PHP project to rails.
I have 7 database servers, I replicate the data from these to one beefy server for feeding the website. I'm trying to figure out how I can do the modeling with Rails without having to make/remove classes if I add/remove a server and have use of all the builtin Rails relationships. Here's a brief layout:
id, name, ip, etc
Then I have tables for each server:
There are 15 other tables that relate to the device with the same format, <server_id>_<tablename>. I can't merge them without having the ID's overlap, and it would make huge tables.
I have a table called Devices, with the DeviceID and ServerID. In PHP, I query it with DeviceID to find the ServerID and then use:
wherever I need a specific table.
Any idea's how I can do that in Rails?
Last edited by Drognan (2012-02-27 17:08:42)