STI types stored in a database

I am trying to:

avoid redundancy of types in tables
link every type with additional information (eg: type descripton…)

Does anyone know if there’s a way to substitute the type column with a
type_id column, that would link to a types table ?

ngumamonene wrote:

I am trying to:

avoid redundancy of types in tables
link every type with additional information (eg: type descripton…)

Does anyone know if there’s a way to substitute the type column with a
type_id column, that would link to a types table ?

Nope. That would be really evil, since you’d have to do a join or 2nd
select every time you wanted to get the concrete class for a row. A few
extra bytes per row is a small price to pay for avoiding all that pain.


Josh S.
http://blog.hasmanythrough.com/

So i guess my only solution if i want to sort by type is to create an
index on a varchar column… I am not an expert at databases, but do
you know if this would be considered bad practice?