From: Ryan Glover Date: 2006-12-28T10:19:29+09:00 Subject: Re: Modified Single Table Inheritance Hello David, > Why are they deriving from a single class anyway? All the objects are the same thing, so to speak. As a silly example of what I am trying to do, let's say that each user an array named fruit. There are many types of fruit and each have their own unique attributes (# of grapes, fuzziness index of peach, banana radius) but they are all fruit. My program is just like this, except I have hundreds of fruit. Perhaps even a thousand. Ideally I would like to be able to add more fruit as the program evolves just by adding a new fruit subclass and a new fruit view. > > I can't understand this. It's rather common that an ORM database schema > has a number of tables in the same order of magnitude as there are model > classes. My biased opinion is that data should be modelled on the > database level where you have some theorethical foundations about what > are "good shapes" for the data. It also doesn't hurt to at least make > the DB schema somewhat document the data model - the data an application > gathers / stores is the most likely part of it to persist in the long > term. Of course, you're probably in a better position to judge this. > I guess my problem with 100's perhaps a 1000 tables is db performance. I don't have oracle, only mysql or postgres. Performance wise, wouldnt it be better to have a few thousand rows in one table as opposed to a few dozen spread across 100's of tables? > Database schemas like this tend to make it into The Daily WTF with some > regularity. > > (Unfortunately, they also make it into production systems.) > > If there's a chance someday, someone, somewhy might want to access your > data at a DB level (using a reporting tool maybe), there'd be no end to > the grief. > > Or, if a bug in your code gets the database into an inconsistent state, > and you have to drop down to SQL to patch things up. > > Avoid. I appreciate all these warnings and I understand what you are saying. In this case I am client for the project so I'll take my lumps as they come. Thanks for your response, Ryan Glover -- Posted via http://www.ruby-forum.com/.