WordPress.org

Make WordPress Core

Ticket #9422: 9422-ids.diff

File 9422-ids.diff, 5.3 KB (added by Denis-de-Bernardy, 5 years ago)

enforce consistent ID types to allow for foreign keys to be defined between tables

  • Users/denis/Sites/wp/wp-includes/version.php

     
    1515 * 
    1616 * @global int $wp_db_version 
    1717 */ 
    18 $wp_db_version = 10738; 
     18$wp_db_version = 10850; 
    1919 
    2020?> 
  • Users/denis/Sites/wp/wp-admin/includes/schema.php

     
    2828 
    2929/** Create WordPress database tables SQL */ 
    3030$wp_queries = "CREATE TABLE $wpdb->terms ( 
    31  term_id bigint(20) NOT NULL auto_increment, 
     31 term_id bigint(20) unsigned NOT NULL auto_increment, 
    3232 name varchar(200) NOT NULL default '', 
    3333 slug varchar(200) NOT NULL default '', 
    3434 term_group bigint(10) NOT NULL default 0, 
     
    3737 KEY name (name) 
    3838) $charset_collate; 
    3939CREATE TABLE $wpdb->term_taxonomy ( 
    40  term_taxonomy_id bigint(20) NOT NULL auto_increment, 
    41  term_id bigint(20) NOT NULL default 0, 
     40 term_taxonomy_id bigint(20) unsigned NOT NULL auto_increment, 
     41 term_id bigint(20) unsigned NOT NULL default 0, 
    4242 taxonomy varchar(32) NOT NULL default '', 
    4343 description longtext NOT NULL, 
    44  parent bigint(20) NOT NULL default 0, 
     44 parent bigint(20) unsigned NOT NULL default 0, 
    4545 count bigint(20) NOT NULL default 0, 
    4646 PRIMARY KEY  (term_taxonomy_id), 
    4747 UNIQUE KEY term_id_taxonomy (term_id,taxonomy), 
    4848 KEY taxonomy (taxonomy) 
    4949) $charset_collate; 
    5050CREATE TABLE $wpdb->term_relationships ( 
    51  object_id bigint(20) NOT NULL default 0, 
    52  term_taxonomy_id bigint(20) NOT NULL default 0, 
     51 object_id bigint(20) unsigned NOT NULL default 0, 
     52 term_taxonomy_id bigint(20) unsigned NOT NULL default 0, 
    5353 term_order int(11) NOT NULL default 0, 
    5454 PRIMARY KEY  (object_id,term_taxonomy_id), 
    5555 KEY term_taxonomy_id (term_taxonomy_id) 
    5656) $charset_collate; 
    5757CREATE TABLE $wpdb->comments ( 
    5858  comment_ID bigint(20) unsigned NOT NULL auto_increment, 
    59   comment_post_ID int(11) NOT NULL default '0', 
     59  comment_post_ID bigint(20) unsigned NOT NULL default '0', 
    6060  comment_author tinytext NOT NULL, 
    6161  comment_author_email varchar(100) NOT NULL default '', 
    6262  comment_author_url varchar(200) NOT NULL default '', 
     
    6969  comment_agent varchar(255) NOT NULL default '', 
    7070  comment_type varchar(20) NOT NULL default '', 
    7171  comment_parent bigint(20) NOT NULL default '0', 
    72   user_id bigint(20) NOT NULL default '0', 
     72  user_id bigint(20) unsigned NOT NULL default '0', 
    7373  PRIMARY KEY  (comment_ID), 
    7474  KEY comment_approved (comment_approved), 
    7575  KEY comment_post_ID (comment_post_ID), 
     
    7777  KEY comment_date_gmt (comment_date_gmt) 
    7878) $charset_collate; 
    7979CREATE TABLE $wpdb->links ( 
    80   link_id bigint(20) NOT NULL auto_increment, 
     80  link_id bigint(20) unsigned NOT NULL auto_increment, 
    8181  link_url varchar(255) NOT NULL default '', 
    8282  link_name varchar(255) NOT NULL default '', 
    8383  link_image varchar(255) NOT NULL default '', 
     
    8585  link_category bigint(20) NOT NULL default '0', 
    8686  link_description varchar(255) NOT NULL default '', 
    8787  link_visible varchar(20) NOT NULL default 'Y', 
    88   link_owner int(11) NOT NULL default '1', 
     88  link_owner bigint(20) NOT NULL default '1', 
    8989  link_rating int(11) NOT NULL default '0', 
    9090  link_updated datetime NOT NULL default '0000-00-00 00:00:00', 
    9191  link_rel varchar(255) NOT NULL default '', 
     
    9696  KEY link_visible (link_visible) 
    9797) $charset_collate; 
    9898CREATE TABLE $wpdb->options ( 
    99   option_id bigint(20) NOT NULL auto_increment, 
     99  option_id bigint(20) unsigned NOT NULL auto_increment, 
    100100  blog_id int(11) NOT NULL default '0', 
    101101  option_name varchar(64) NOT NULL default '', 
    102102  option_value longtext NOT NULL, 
     
    105105  KEY option_name (option_name) 
    106106) $charset_collate; 
    107107CREATE TABLE $wpdb->postmeta ( 
    108   meta_id bigint(20) NOT NULL auto_increment, 
    109   post_id bigint(20) NOT NULL default '0', 
     108  meta_id bigint(20) unsigned NOT NULL auto_increment, 
     109  post_id bigint(20) unsigned NOT NULL default '0', 
    110110  meta_key varchar(255) default NULL, 
    111111  meta_value longtext, 
    112112  PRIMARY KEY  (meta_id), 
     
    115115) $charset_collate; 
    116116CREATE TABLE $wpdb->posts ( 
    117117  ID bigint(20) unsigned NOT NULL auto_increment, 
    118   post_author bigint(20) NOT NULL default '0', 
     118  post_author bigint(20) unsigned NOT NULL default '0', 
    119119  post_date datetime NOT NULL default '0000-00-00 00:00:00', 
    120120  post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', 
    121121  post_content longtext NOT NULL, 
     
    132132  post_modified datetime NOT NULL default '0000-00-00 00:00:00', 
    133133  post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', 
    134134  post_content_filtered text NOT NULL, 
    135   post_parent bigint(20) NOT NULL default '0', 
     135  post_parent bigint(20) unsigned NOT NULL default '0', 
    136136  guid varchar(255) NOT NULL default '', 
    137137  menu_order int(11) NOT NULL default '0', 
    138138  post_type varchar(20) NOT NULL default 'post', 
     
    159159  KEY user_nicename (user_nicename) 
    160160) $charset_collate; 
    161161CREATE TABLE $wpdb->usermeta ( 
    162   umeta_id bigint(20) NOT NULL auto_increment, 
    163   user_id bigint(20) NOT NULL default '0', 
     162  umeta_id bigint(20) unsigned NOT NULL auto_increment, 
     163  user_id bigint(20) unsigned NOT NULL default '0', 
    164164  meta_key varchar(255) default NULL, 
    165165  meta_value longtext, 
    166166  PRIMARY KEY  (umeta_id),