Hi Folks,
I am working on a site-specific plugin that will allow the admin to create a number of entities that are associated through a project. For this plugin, I will be creating custom post types for Person, Funder, and Topic. These types will be associated in a one-to-many relationship with another custom post type, Projects. In other words, each Project will have many Persons, Funders, and Topics. Through these associations, I will be able to look up any of these custom types and see other types that are associated with them.
My question is this; what would be the best way to associate Person, Funder and Topic with Projects? My previous experience with database schema would have me create association tables that would hold fields for something like person_id and project_id, which would create an association between these two types. I want to make sure that I'm not unnecessarily creating a table in WP, so I thought I might check in here to see if this was a good solution or not.
I did consider create a new row in postmeta for each project that holds the associations. My issue with this structure is that it would be difficult for me to look up Person and see which projects are associated with that person. To do so, I'd have to query for every project association row in the postmeta table and examine it to see which projects matched the person.
My other question is about the WP database structure in general. I'm a self-taught php programmer, so my knowledge isn't fully rounded out. My understanding of good database structure is that the schema is normalized. From my understanding of this concept, the WP database is not normalized. I'm assuming that this database structure follows another theory. Could anyone enlighten me to what this theory might be? I'd like to read more about it.
Thanks so much!


LinkBack URL
About LinkBacks
Reply With Quote
