Yeah it's a bit hard to explain. I hope to do better this time. To preface, the reason for this schema I'm about to explain is because I have many different item types and each one has a different set of attributes that I want to store. The desired set of attributes that I want to collect can also change, sometimes frequently.
When trying to layout the schema with tables for each item type, we started looking at a lot of tables, with a lot of complex rules and relations. The kind of schema that makes you run away screaming. We came up with this alternate schema which uses a 'virtual schema' or definition for each item type is stored in a table. So instead of the traditional table like this: Table: cogs Fields: name, model, size, color We have something like this that replicates it: Table: item_types Fields: id, name Insert Into: 1, cogs Table: item_types_attributes Fields: item_type_id, attribute_name, field_type Insert Into 1, model, text Insert Into 1, size, text Insert Into 1, color, text The data in those two tables describe to the application the kinds of data to collect for a cog. Then when storing the cog data it is handled much the same way. The table structure is like: Table: items Fields: item_type,name Insert Into: 1, cog1 Table: item_attributes Fields: item, attribute, value Insert Into: cog1, model, 7500 series Insert Into: cog1, size, large Insert Into: cog1, color, blue Where an attribute record is added for each attribute collected for this item. I'm sure this kind of database design has a name, but I don't know it, I've seen it in several applications, most recently was in a drupal module. To do the updating, you would query and merge info from both the definition and the attributes data to build the editing form. I'm trying to see how I would handle the CRUD of the items defined in this virtual schema, and not administration of the virtual schema itself. that I know that cake can handle as it's just table relations. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---
