Index: trunk/phase3/maintenance/archives/patch-cl_type.sql |
— | — | @@ -0,0 +1,6 @@ |
| 2 | +-- |
| 3 | +-- Change cl_type to a varchar from an enum because of the weird semantics of |
| 4 | +-- the < and > operators when working with enums |
| 5 | +-- |
| 6 | + |
| 7 | +ALTER TABLE categorylinks MODIFY cl_type varchar(6) NOT NULL default 'page'; |
Property changes on: trunk/phase3/maintenance/archives/patch-cl_type.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 8 | + native |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -521,7 +521,9 @@ |
522 | 522 | -- paginate the three categories separately. This never has to be updated |
523 | 523 | -- after the page is created, since none of these page types can be moved to |
524 | 524 | -- any other. |
525 | | - cl_type ENUM('page', 'subcat', 'file') NOT NULL default 'page' |
| 525 | + -- This used to be ENUM('page', 'subcat', 'file') but was changed to a |
| 526 | + -- varchar because of the weird semantics of < and > when used on enums |
| 527 | + cl_type varchar(6) NOT NULL default 'page' |
526 | 528 | ) /*$wgDBTableOptions*/; |
527 | 529 | |
528 | 530 | CREATE UNIQUE INDEX /*i*/cl_from ON /*_*/categorylinks (cl_from,cl_to); |
Index: trunk/phase3/includes/installer/MysqlUpdater.php |
— | — | @@ -175,6 +175,7 @@ |
176 | 176 | array( 'dropIndex', 'archive', 'ar_page_revid', 'patch-archive_kill_ar_page_revid.sql' ), |
177 | 177 | array( 'addIndex', 'archive', 'ar_revid', 'patch-archive_ar_revid.sql' ), |
178 | 178 | array( 'doLangLinksLengthUpdate' ), |
| 179 | + array( 'doClTypeVarcharUpdate' ), |
179 | 180 | ); |
180 | 181 | } |
181 | 182 | |
— | — | @@ -828,4 +829,18 @@ |
829 | 830 | $this->output( "...ll_lang is up-to-date.\n" ); |
830 | 831 | } |
831 | 832 | } |
| 833 | + |
| 834 | + protected function doClTypeVarcharUpdate() { |
| 835 | + $categorylinks = $this->db->tableName( 'categorylinks' ); |
| 836 | + $res = $this->db->query( "SHOW COLUMNS FROM $categorylinks LIKE 'cl_type'" ); |
| 837 | + $row = $this->db->fetchObject( $res ); |
| 838 | + |
| 839 | + if ( $row && substr( $row->Type, 0, 4 ) == 'enum' ) { |
| 840 | + $this->output( 'Changing cl_type from enum to varchar...' ); |
| 841 | + $this->applyPatch( 'patch-cl_type.sql' ); |
| 842 | + $this->output( "done.\n" ); |
| 843 | + } else { |
| 844 | + $this->output( "...cl_type is up-to-date.\n" ); |
| 845 | + } |
| 846 | + } |
832 | 847 | } |