0

Hi-

I'm designing the database for my app and am trying to do it as intelligently as possible. I'm trying to avoid an explosion of tables and thought single table inheritance (STI) might be the answer..... Is it me or is the use of foreign key constraints (nearly?) impossible when making associations between entities using STI? Any thoughts on this would be extremely helpful.

Thanks

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by pty
0

Hi-

I'm designing the database for my app and am trying to do it as intelligently as possible. I'm trying to avoid an explosion of tables and thought single table inheritance (STI) might be the answer..... Is it me or is the use of foreign key constraints (nearly?) impossible when making associations between entities using STI? Any thoughts on this would be extremely helpful.

Thanks

From my experience using STI isn't too bad so long as too many models are involved; it can get messy using the rails method with the 'type' column.

Of course you could try with CTI but its experimental at the moment and I wouldn't use it for anything critical

http://wiki.rubyonrails.org/rails/pages/ClassTableInheritanceInRails

For more complicated uses I'd try to steer clear of inheritance in rails and use relationships between models; not always the cleanest but probably more reliable/robust in the long run

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.