[wp-hackers] 2.4 Feature Proposal: New general meta-data table

usleepless at gmail.com usleepless at gmail.com
Thu Oct 4 21:52:44 GMT 2007


On 10/4/07, Otto <otto at ottodestruct.com> wrote:
> Well, here's a first stab at it:
> 
> CREATE TABLE $wpdb->meta (
>   meta_id bigint(20) NOT NULL auto_increment,
>   object_id bigint(20) NOT NULL default 0,
>   meta_type varchar(32) NOT NULL default '',
>   meta_key varchar(255) default NULL,
>   meta_value longtext,
>   PRIMARY KEY  (meta_id),
>   KEY meta_key (meta_key)
>   KEY meta_type (meta_type)
> ) $charset_collate;

"good practice" would make:

CREATE TABLE `$wpdb->meta` (
   `meta_id` bigint(20) NOT NULL auto_increment,
   `object_id` bigint(20) NOT NULL default 0,
   `meta_type` varchar(32) NOT NULL default '',
   `meta_key` varchar(255) default NULL,
   `meta_value` longtext,
   PRIMARY KEY  (`meta_id`),
   KEY meta_key (`meta_key`)
   KEY meta_type (`meta_type`)
) $charset_collate;

or it might:

CREATE TABLE $wpdb->meta (
   meta_id $auto_increment_type NOT NULL $auto_increment,
   object_id $bigint NOT NULL default 0,
   meta_type varchar(32) NOT NULL default '',
   meta_key varchar(255) default NULL,
   meta_value $longtext,
   PRIMARY KEY  (meta_id)
) $charset_collate;
CREATE INDEX idx_meta_meta_key ON $wpdb->meta(meta_key);
CREATE INDEX idx_meta_meta_type ON $wpdb->meta(meta_type);

regards,

usleep


More information about the wp-hackers mailing list