[Dbix-class] Re: flexible attributes on db objects

A. Pagaltzis pagaltzis at gmx.de
Fri Jun 15 16:29:30 GMT 2007


Some minor corrections/clarifications:

* A. Pagaltzis <pagaltzis at gmx.de> [2007-06-15 09:05]:
>     document (
>         id,
>     )
> 
>     revision (
>         id autoincrement,
>         doc_id references document(id),
>         num,
>     )

This isn’t quite true, of course. There is more data in those
tables. Still, they’re both very sparse.

> And then there is a whole array of tables and join tables like
> the text_value/text_attribute pair for various data types (not
> DB-centric data types, but app-centric ones; eg. several tables
> with TEXT columns, where in one of them there is inline HTML,
> in another there are full HTML documents, in another there are
> just plaintext labels, etc.).

On re-read I realise this might be easy to misinterpret. Most
value tables have only a single value column. Thus I have

    text_value    ( id INTEGER PRIMARY KEY AUTOINCREMENT, content TEXT )
    html_value    ( id INTEGER PRIMARY KEY AUTOINCREMENT, content TEXT )
    htmldoc_value ( id INTEGER PRIMARY KEY AUTOINCREMENT, content TEXT )

Etc.

And yeah, as Jess said, it’s DB-in-DB. I even have constraint
enforcement code in the app logic. I don’t do *everything* with
this structure though; I try to push modelling from the meta-
schema back down into the schema whenever feasible. If nothing
else, it makes it much easier to query the beast: working with a
supernormalised schema like this one is a right pain if you want
to query on it. I try to have all the data I need for joins
available directly.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Dbix-class mailing list