array( 'dropIndex', 'archive', 'ar_page_revid', 'patch-archive_kill_ar_page_revid.sql' ),
array( 'addIndex', 'archive', 'ar_revid', 'patch-archive_ar_revid.sql' ),
array( 'doLangLinksLengthUpdate' ),
+ array( 'doClTypeVarcharUpdate' ),
);
}
$this->output( "...ll_lang is up-to-date.\n" );
}
}
+
+ protected function doClTypeVarcharUpdate() {
+ $categorylinks = $this->db->tableName( 'categorylinks' );
+ $res = $this->db->query( "SHOW COLUMNS FROM $categorylinks LIKE 'cl_type'" );
+ $row = $this->db->fetchObject( $res );
+
+ if ( $row && substr( $row->Type, 0, 4 ) == 'enum' ) {
+ $this->output( 'Changing cl_type from enum to varchar...' );
+ $this->applyPatch( 'patch-cl_type.sql' );
+ $this->output( "done.\n" );
+ } else {
+ $this->output( "...cl_type is up-to-date.\n" );
+ }
+ }
}
--- /dev/null
+--
+-- Change cl_type to a varchar from an enum because of the weird semantics of
+-- the < and > operators when working with enums
+--
+
+ALTER TABLE categorylinks MODIFY cl_type varchar(6) NOT NULL default 'page';
-- paginate the three categories separately. This never has to be updated
-- after the page is created, since none of these page types can be moved to
-- any other.
- cl_type ENUM('page', 'subcat', 'file') NOT NULL default 'page'
+ -- This used to be ENUM('page', 'subcat', 'file') but was changed to a
+ -- varchar because of the weird semantics of < and > when used on enums
+ cl_type varchar(6) NOT NULL default 'page'
) /*$wgDBTableOptions*/;
CREATE UNIQUE INDEX /*i*/cl_from ON /*_*/categorylinks (cl_from,cl_to);