[wp-hackers] alternative taxonomy to relate users to pages

scribu scribu at gmail.com
Wed Feb 10 13:16:44 UTC 2010


On Wed, Feb 10, 2010 at 1:48 PM, <anybody at nobodyhere.com> wrote:

> After reading Murray Woodman
> (http://murraywoodman.com/355/wordpress-taxonomies) I'm considering the
> following mysql table structure:
>
> RELATIONS
> - id
> - subject_id
> - subject_type (user/page/post/comment)
> - predicate_id
> - object_id
> - object_type
>
> PREDICATES
> - id
> - title (e.g. "is part of", "likes")
> - slug (e.g. "part_of", "likes")
>
> Any suggestions?
>


I think having a separate predicates table is a bit overkill.  I would
replace it with a single column in the RELATIONS table:

RELATIONS
- id
- subject_id
- subject_type
- predicate (e.g. "is_part_of", "likes")
- object_id
- object_type

You could also add an optional "date" column, to record when a relationship
was formed.


isn't it possible to do by custom fields?


Not if you want many-to-many relationships.


-- 
http://scribu.net


More information about the wp-hackers mailing list