r19632 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r19631‎ | r19632 | r19633 >
Date:17:04, 24 January 2007
Author:brion
Status:old
Tags:
Comment:
* (bug 8749) Bring MySQL 5 table defs back into sync
Patch from siebrand: http://bugzilla.wikimedia.org/attachment.cgi?id=3131
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/maintenance/mysql5/tables-binary.sql (modified) (history)
  • /trunk/phase3/maintenance/mysql5/tables.sql (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/mysql5/tables.sql
@@ -90,7 +90,7 @@
9191 -- Timestamp of the last time when a new password was
9292 -- sent, for throttling purposes
9393 user_newpass_time char(14) binary,
94 -
 94+
9595 -- Note: email should be restricted, not public info.
9696 -- Same with passwords.
9797 user_email tinytext NOT NULL,
@@ -181,6 +181,7 @@
182182 user_ip varchar(40) NOT NULL default '',
183183 INDEX user_id (user_id),
184184 INDEX user_ip (user_ip)
 185+
185186 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
186187
187188
@@ -419,7 +420,6 @@
420421
421422 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
422423
423 -
424424 --
425425 -- Track links to images *used inline*
426426 -- We don't distinguish live from broken links here, so
@@ -456,7 +456,8 @@
457457 -- The title of the linking page, or an optional override
458458 -- to determine sort order. Sorting is by binary order, which
459459 -- isn't always ideal, but collations seem to be an exciting
460 - -- and dangerous new world in MySQL...
 460+ -- and dangerous new world in MySQL... The sortkey is updated
 461+ -- if no override exists and cl_from is renamed.
461462 --
462463 -- For MySQL 4.1+ with charset set to utf8, the sort key *index*
463464 -- needs cut to be smaller than 1024 bytes (at 3 bytes per char).
@@ -599,8 +600,8 @@
600601 -- Indicates that the IP address was banned because a banned
601602 -- user accessed a page through it. If this is 1, ipb_address
602603 -- will be hidden, and the block identified by block ID number.
603 - ipb_auto bool NOT NULL default '0',
604 -
 604+ ipb_auto bool NOT NULL default 0,
 605+
605606 -- If set to 1, block applies only to logged-out users
606607 ipb_anon_only bool NOT NULL default 0,
607608
@@ -609,15 +610,15 @@
610611
611612 -- Block triggers autoblocks
612613 ipb_enable_autoblock bool NOT NULL default '1',
613 -
 614+
614615 -- Time at which the block will expire.
615616 ipb_expiry char(14) binary NOT NULL default '',
616617
617618 -- Start and end of an address range, in hexadecimal
618619 -- Size chosen to allow IPv6
619 - ipb_range_start varchar(32) NOT NULL default '',
620 - ipb_range_end varchar(32) NOT NULL default '',
621 -
 620+ ipb_range_start tinyblob NOT NULL,
 621+ ipb_range_end tinyblob NOT NULL,
 622+
622623 PRIMARY KEY ipb_id (ipb_id),
623624
624625 -- Unique index to support "user already blocked" messages
@@ -673,7 +674,7 @@
674675
675676 -- user_id and user_name of uploader.
676677 img_user int(5) unsigned NOT NULL default '0',
677 - img_user_text varchar(255) binary NOT NULL default '',
 678+ img_user_text varchar(255) binary NOT NULL,
678679
679680 -- Time of the upload.
680681 img_timestamp char(14) binary NOT NULL default '',
@@ -708,14 +709,13 @@
709710 oi_bits int(3) NOT NULL default 0,
710711 oi_description tinyblob NOT NULL,
711712 oi_user int(5) unsigned NOT NULL default '0',
712 - oi_user_text varchar(255) binary NOT NULL default '',
 713+ oi_user_text varchar(255) binary NOT NULL,
713714 oi_timestamp char(14) binary NOT NULL default '',
714715
715716 INDEX oi_name (oi_name(10))
716717
717718 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
718719
719 -
720720 --
721721 -- Record of deleted file data
722722 --
@@ -757,7 +757,7 @@
758758 fa_minor_mime varchar(32) default "unknown",
759759 fa_description tinyblob,
760760 fa_user int(5) unsigned default '0',
761 - fa_user_text varchar(255) binary default '',
 761+ fa_user_text varchar(255) binary,
762762 fa_timestamp char(14) binary default '',
763763
764764 PRIMARY KEY (fa_id),
@@ -780,7 +780,7 @@
781781
782782 -- As in revision
783783 rc_user int(10) unsigned NOT NULL default '0',
784 - rc_user_text varchar(255) binary NOT NULL default '',
 784+ rc_user_text varchar(255) binary NOT NULL,
785785
786786 -- When pages are renamed, their RC entries do _not_ change.
787787 rc_namespace int NOT NULL default '0',
@@ -825,16 +825,17 @@
826826
827827 -- Text length in characters before
828828 -- and after the edit
829 - rc_old_len int(10) default '0',
830 - rc_new_len int(10) default '0',
831 -
 829+ rc_old_len int(10),
 830+ rc_new_len int(10),
 831+
832832 PRIMARY KEY rc_id (rc_id),
833833 INDEX rc_timestamp (rc_timestamp),
834834 INDEX rc_namespace_title (rc_namespace, rc_title),
835835 INDEX rc_cur_id (rc_cur_id),
836836 INDEX new_name_timestamp (rc_new,rc_namespace,rc_timestamp),
837837 INDEX rc_ip (rc_ip),
838 - INDEX rc_ns_usertext ( rc_namespace, rc_user_text )
 838+ INDEX rc_ns_usertext (rc_namespace, rc_user_text),
 839+ INDEX rc_user_text (rc_user_text, rc_timestamp)
839840
840841 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
841842
@@ -853,7 +854,7 @@
854855 wl_notificationtimestamp varchar(14) binary,
855856
856857 UNIQUE KEY (wl_user, wl_namespace, wl_title),
857 - KEY namespace_title (wl_namespace,wl_title)
 858+ KEY namespace_title (wl_namespace, wl_title)
858859
859860 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
860861
@@ -996,7 +997,8 @@
997998
998999 KEY type_time (log_type, log_timestamp),
9991000 KEY user_time (log_user, log_timestamp),
1000 - KEY page_time (log_namespace, log_title, log_timestamp)
 1001+ KEY page_time (log_namespace, log_title, log_timestamp),
 1002+ KEY times (log_timestamp)
10011003
10021004 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
10031005
@@ -1012,6 +1014,7 @@
10131015 INDEX (tb_page)
10141016 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
10151017
 1018+
10161019 -- Jobs performed by parallel apache threads or a command-line daemon
10171020 CREATE TABLE /*$wgDBprefix*/job (
10181021 job_id int(9) unsigned NOT NULL auto_increment,
@@ -1032,6 +1035,7 @@
10331036 KEY (job_cmd, job_namespace, job_title)
10341037 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
10351038
 1039+
10361040 -- Details of updates to cached special pages
10371041 CREATE TABLE /*$wgDBprefix*/querycache_info (
10381042
@@ -1063,7 +1067,6 @@
10641068 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
10651069
10661070 -- Used for caching expensive grouped queries that need two links (for example double-redirects)
1067 -
10681071 CREATE TABLE /*$wgDBprefix*/querycachetwo (
10691072 -- A key name, generally the base name of of the special page.
10701073 qcc_type char(32) NOT NULL,
@@ -1084,3 +1087,26 @@
10851088 KEY qcc_titletwo (qcc_type,qcc_namespacetwo,qcc_titletwo)
10861089
10871090 ) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
 1091+
 1092+--- Used for storing page restrictions (i.e. protection levels)
 1093+CREATE TABLE /*$wgDBprefix*/page_restrictions (
 1094+ -- Page to apply restrictions to (Foreign Key to page).
 1095+ pr_page int(8) NOT NULL,
 1096+ -- The protection type (edit, move, etc)
 1097+ pr_type varchar(255) NOT NULL,
 1098+ -- The protection level (Sysop, autoconfirmed, etc)
 1099+ pr_level varchar(255) NOT NULL,
 1100+ -- Whether or not to cascade the protection down to pages transcluded.
 1101+ pr_cascade tinyint(4) NOT NULL,
 1102+ -- Field for future support of per-user restriction.
 1103+ pr_user int(8) NULL,
 1104+ -- Field for time-limited protection.
 1105+ pr_expiry char(14) binary NULL,
 1106+
 1107+ PRIMARY KEY (pr_page,pr_type),
 1108+
 1109+ KEY pr_page (pr_page),
 1110+ KEY pr_typelevel (pr_type,pr_level),
 1111+ KEY pr_level (pr_level),
 1112+ KEY pr_cascade (pr_cascade)
 1113+) ENGINE=InnoDB, DEFAULT CHARSET=utf8;
Index: trunk/phase3/maintenance/mysql5/tables-binary.sql
@@ -99,7 +99,7 @@
100100 -- Timestamp of the last time when a new password was
101101 -- sent, for throttling purposes
102102 user_newpass_time char(14) binary,
103 -
 103+
104104 -- Note: email should be restricted, not public info.
105105 -- Same with passwords.
106106 user_email tinytext NOT NULL,
@@ -190,6 +190,7 @@
191191 user_ip varchar(40) NOT NULL default '',
192192 INDEX user_id (user_id),
193193 INDEX user_ip (user_ip)
 194+
194195 ) ENGINE=InnoDB, DEFAULT CHARSET=binary;
195196
196197
@@ -428,7 +429,6 @@
429430
430431 ) ENGINE=InnoDB, DEFAULT CHARSET=binary;
431432
432 -
433433 --
434434 -- Track links to images *used inline*
435435 -- We don't distinguish live from broken links here, so
@@ -465,7 +465,8 @@
466466 -- The title of the linking page, or an optional override
467467 -- to determine sort order. Sorting is by binary order, which
468468 -- isn't always ideal, but collations seem to be an exciting
469 - -- and dangerous new world in MySQL...
 469+ -- and dangerous new world in MySQL... The sortkey is updated
 470+ -- if no override exists and cl_from is renamed.
470471 --
471472 -- For MySQL 4.1+ with charset set to utf8, the sort key *index*
472473 -- needs cut to be smaller than 1024 bytes (at 3 bytes per char).
@@ -608,8 +609,8 @@
609610 -- Indicates that the IP address was banned because a banned
610611 -- user accessed a page through it. If this is 1, ipb_address
611612 -- will be hidden, and the block identified by block ID number.
612 - ipb_auto bool NOT NULL default '0',
613 -
 613+ ipb_auto bool NOT NULL default 0,
 614+
614615 -- If set to 1, block applies only to logged-out users
615616 ipb_anon_only bool NOT NULL default 0,
616617
@@ -618,14 +619,14 @@
619620
620621 -- Block triggers autoblocks
621622 ipb_enable_autoblock bool NOT NULL default '1',
622 -
 623+
623624 -- Time at which the block will expire.
624625 ipb_expiry char(14) binary NOT NULL default '',
625626
626627 -- Start and end of an address range, in hexadecimal
627628 -- Size chosen to allow IPv6
628 - ipb_range_start varchar(32) NOT NULL default '',
629 - ipb_range_end varchar(32) NOT NULL default '',
 629+ ipb_range_start tinyblob NOT NULL,
 630+ ipb_range_end tinyblob NOT NULL,
630631
631632 PRIMARY KEY ipb_id (ipb_id),
632633
@@ -682,7 +683,7 @@
683684
684685 -- user_id and user_name of uploader.
685686 img_user int(5) unsigned NOT NULL default '0',
686 - img_user_text varchar(255) binary NOT NULL default '',
 687+ img_user_text varchar(255) binary NOT NULL,
687688
688689 -- Time of the upload.
689690 img_timestamp char(14) binary NOT NULL default '',
@@ -717,14 +718,13 @@
718719 oi_bits int(3) NOT NULL default 0,
719720 oi_description tinyblob NOT NULL,
720721 oi_user int(5) unsigned NOT NULL default '0',
721 - oi_user_text varchar(255) binary NOT NULL default '',
 722+ oi_user_text varchar(255) binary NOT NULL,
722723 oi_timestamp char(14) binary NOT NULL default '',
723724
724725 INDEX oi_name (oi_name(10))
725726
726727 ) ENGINE=InnoDB, DEFAULT CHARSET=binary;
727728
728 -
729729 --
730730 -- Record of deleted file data
731731 --
@@ -766,7 +766,7 @@
767767 fa_minor_mime varchar(32) default "unknown",
768768 fa_description tinyblob,
769769 fa_user int(5) unsigned default '0',
770 - fa_user_text varchar(255) binary default '',
 770+ fa_user_text varchar(255) binary,
771771 fa_timestamp char(14) binary default '',
772772
773773 PRIMARY KEY (fa_id),
@@ -789,7 +789,7 @@
790790
791791 -- As in revision
792792 rc_user int(10) unsigned NOT NULL default '0',
793 - rc_user_text varchar(255) binary NOT NULL default '',
 793+ rc_user_text varchar(255) binary NOT NULL,
794794
795795 -- When pages are renamed, their RC entries do _not_ change.
796796 rc_namespace int NOT NULL default '0',
@@ -834,16 +834,17 @@
835835
836836 -- Text length in characters before
837837 -- and after the edit
838 - rc_old_len int(10) default '0',
839 - rc_new_len int(10) default '0',
840 -
 838+ rc_old_len int(10),
 839+ rc_new_len int(10),
 840+
841841 PRIMARY KEY rc_id (rc_id),
842842 INDEX rc_timestamp (rc_timestamp),
843843 INDEX rc_namespace_title (rc_namespace, rc_title),
844844 INDEX rc_cur_id (rc_cur_id),
845845 INDEX new_name_timestamp (rc_new,rc_namespace,rc_timestamp),
846846 INDEX rc_ip (rc_ip),
847 - INDEX rc_ns_usertext ( rc_namespace, rc_user_text )
 847+ INDEX rc_ns_usertext (rc_namespace, rc_user_text),
 848+ INDEX rc_user_text (rc_user_text, rc_timestamp)
848849
849850 ) ENGINE=InnoDB, DEFAULT CHARSET=binary;
850851
@@ -862,7 +863,7 @@
863864 wl_notificationtimestamp varchar(14) binary,
864865
865866 UNIQUE KEY (wl_user, wl_namespace, wl_title),
866 - KEY namespace_title (wl_namespace,wl_title)
 867+ KEY namespace_title (wl_namespace, wl_title)
867868
868869 ) ENGINE=InnoDB, DEFAULT CHARSET=binary;
869870
@@ -1005,7 +1006,8 @@
10061007
10071008 KEY type_time (log_type, log_timestamp),
10081009 KEY user_time (log_user, log_timestamp),
1009 - KEY page_time (log_namespace, log_title, log_timestamp)
 1010+ KEY page_time (log_namespace, log_title, log_timestamp),
 1011+ KEY times (log_timestamp)
10101012
10111013 ) ENGINE=InnoDB, DEFAULT CHARSET=binary;
10121014
@@ -1021,6 +1023,7 @@
10221024 INDEX (tb_page)
10231025 ) ENGINE=InnoDB, DEFAULT CHARSET=binary;
10241026
 1027+
10251028 -- Jobs performed by parallel apache threads or a command-line daemon
10261029 CREATE TABLE /*$wgDBprefix*/job (
10271030 job_id int(9) unsigned NOT NULL auto_increment,
@@ -1041,6 +1044,7 @@
10421045 KEY (job_cmd, job_namespace, job_title)
10431046 ) ENGINE=InnoDB, DEFAULT CHARSET=binary;
10441047
 1048+
10451049 -- Details of updates to cached special pages
10461050 CREATE TABLE /*$wgDBprefix*/querycache_info (
10471051
@@ -1072,7 +1076,6 @@
10731077 ) ENGINE=InnoDB, DEFAULT CHARSET=binary;
10741078
10751079 -- Used for caching expensive grouped queries that need two links (for example double-redirects)
1076 -
10771080 CREATE TABLE /*$wgDBprefix*/querycachetwo (
10781081 -- A key name, generally the base name of of the special page.
10791082 qcc_type char(32) NOT NULL,
@@ -1093,3 +1096,26 @@
10941097 KEY qcc_titletwo (qcc_type,qcc_namespacetwo,qcc_titletwo)
10951098
10961099 ) ENGINE=InnoDB, DEFAULT CHARSET=binary;
 1100+
 1101+--- Used for storing page restrictions (i.e. protection levels)
 1102+CREATE TABLE /*$wgDBprefix*/page_restrictions (
 1103+ -- Page to apply restrictions to (Foreign Key to page).
 1104+ pr_page int(8) NOT NULL,
 1105+ -- The protection type (edit, move, etc)
 1106+ pr_type varchar(255) NOT NULL,
 1107+ -- The protection level (Sysop, autoconfirmed, etc)
 1108+ pr_level varchar(255) NOT NULL,
 1109+ -- Whether or not to cascade the protection down to pages transcluded.
 1110+ pr_cascade tinyint(4) NOT NULL,
 1111+ -- Field for future support of per-user restriction.
 1112+ pr_user int(8) NULL,
 1113+ -- Field for time-limited protection.
 1114+ pr_expiry char(14) binary NULL,
 1115+
 1116+ PRIMARY KEY (pr_page,pr_type),
 1117+
 1118+ KEY pr_page (pr_page),
 1119+ KEY pr_typelevel (pr_type,pr_level),
 1120+ KEY pr_level (pr_level),
 1121+ KEY pr_cascade (pr_cascade)
 1122+) ENGINE=InnoDB, DEFAULT CHARSET=binary;
Index: trunk/phase3/RELEASE-NOTES
@@ -144,6 +144,7 @@
145145 * Added an option to make Linker::userToolLinks() show the contribs link
146146 red when the user has no edits. Linker::userToolLinksRedContribs() is an
147147 alias to that which should be used to make it more self documentating.
 148+* (bug 8749) Bring MySQL 5 table defs back into sync
148149
149150
150151 == Languages updated ==