[wp-hackers] Meta tables: Take 5

Beau Lebens beau at dentedreality.com.au
Fri Jul 24 18:21:52 UTC 2009


I'd personally be opposed to the approach of creating new tables for
every plugin/etc that wanted some meta, if for no other reason than in
a secure environment, my DB user should NOT have (or require) the
privileges to CREATE (or DROP) tables in my database.

The approach I've been thinking would be to have 2 different meta tables (only):

wp_global_meta
wp_meta

then, on an WPMU installation, you'd get

wp_global_meta
wp_1_meta
wp_2_meta
wp_3_meta etc

All of those tables would look the same, and it'd be something like this:

id
object_type
object_id
key
value

So for example, a row might contain:

1
post
123
do_something_cool
yes

Which would apply specifically to the post with the ID 123. The reason
I would go for a global + a blog-specific one is to handle the
requirement for WPMU having the concept of global meta information
(e.g. user meta) that applies across all blogs, while individual blogs
having meta that only relates within the confines of their own
context. This approach would break up the storage a bit to avoid
things getting too monstrously large, while still getting everything
in one place, but allowing for decent table indexing (on object_id).

That's just my 0.02c on the whole issue ;)

Beau


More information about the wp-hackers mailing list