* (bug 719) Increase namespace fields from tinyint to regular int

This keeps custom namespaces from bumping the 8-bit ceiling so quickly.
This commit is contained in:
Brion Vibber 2005-05-02 10:15:02 +00:00
parent 5c7e529edd
commit 480419b3a9
5 changed files with 47 additions and 11 deletions

View file

@ -1095,8 +1095,8 @@ $wgFeedDiffCutoff = 32768;
* no longer be accessible. If you rename it, then you can access them through
* the new namespace name.
*
* Custom namespaces should start at 100 and stop at 255 (hard limit set by
* database).
* Custom namespaces should start at 100 to avoid conflicting with standard
* namespaces, and should always follow the even/odd main/talk pattern.
*/
#$wgExtraNamespaces =
# array(100 => "Hilfe",

View file

@ -16,7 +16,7 @@ CREATE TABLE /*$wgDBprefix*/logging (
-- Key to the page affected. Where a user is the target,
-- this will point to the user page.
log_namespace tinyint unsigned NOT NULL default 0,
log_namespace int NOT NULL default 0,
log_title varchar(255) binary NOT NULL default '',
-- Freeform text. Interpreted as edit history comments.

View file

@ -8,7 +8,7 @@ CREATE TABLE /*$wgDBprefix*/querycache (
qc_value int(5) unsigned NOT NULL default '0',
-- Target namespace+title
qc_namespace tinyint(2) unsigned NOT NULL default '0',
qc_namespace int NOT NULL default '0',
qc_title char(255) binary NOT NULL default '',
KEY (qc_type,qc_value)

View file

@ -149,7 +149,7 @@ CREATE TABLE /*$wgDBprefix*/page (
-- A page name is broken into a namespace and a title.
-- The namespace keys are UI-language-independent constants,
-- defined in Namespace.php.
page_namespace tinyint NOT NULL,
page_namespace int NOT NULL,
-- The rest of the title, as text.
-- Spaces are transformed into underscores in title storage.
@ -286,7 +286,7 @@ CREATE TABLE /*$wgDBprefix*/text (
-- fields, with several caveats.
--
CREATE TABLE /*$wgDBprefix*/archive (
ar_namespace tinyint(2) unsigned NOT NULL default '0',
ar_namespace int NOT NULL default '0',
ar_title varchar(255) binary NOT NULL default '',
-- Newly deleted pages will not store text in this table,
@ -600,7 +600,7 @@ CREATE TABLE /*$wgDBprefix*/recentchanges (
rc_user_text varchar(255) binary NOT NULL default '',
-- When pages are renamed, their RC entries do _not_ change.
rc_namespace tinyint(3) NOT NULL default '0',
rc_namespace int NOT NULL default '0',
rc_title varchar(255) binary NOT NULL default '',
-- as in revision...
@ -656,7 +656,7 @@ CREATE TABLE /*$wgDBprefix*/watchlist (
-- Key to page_namespace/page_title
-- Note that users may watch patches which do not exist yet,
-- or existed in the past but have been deleted.
wl_namespace tinyint(2) unsigned NOT NULL default '0',
wl_namespace int NOT NULL default '0',
wl_title varchar(255) binary NOT NULL default '',
-- Timestamp when user was last sent a notification e-mail;
@ -750,7 +750,7 @@ CREATE TABLE /*$wgDBprefix*/querycache (
qc_value int(5) unsigned NOT NULL default '0',
-- Target namespace+title
qc_namespace tinyint(2) unsigned NOT NULL default '0',
qc_namespace int NOT NULL default '0',
qc_title char(255) binary NOT NULL default '',
KEY (qc_type,qc_value)
@ -796,7 +796,7 @@ CREATE TABLE /*$wgDBprefix*/logging (
-- Key to the page affected. Where a user is the target,
-- this will point to the user page.
log_namespace tinyint unsigned NOT NULL default 0,
log_namespace int NOT NULL default 0,
log_title varchar(255) binary NOT NULL default '',
-- Freeform text. Interpreted as edit history comments.

View file

@ -344,7 +344,7 @@ function do_schema_restructuring() {
echo "......Creating tables.\n";
$wgDatabase->query("CREATE TABLE $page (
page_id int(8) unsigned NOT NULL auto_increment,
page_namespace tinyint NOT NULL,
page_namespace int NOT NULL,
page_title varchar(255) binary NOT NULL,
page_restrictions tinyblob NOT NULL default '',
page_counter bigint(20) unsigned NOT NULL default '0',
@ -437,6 +437,41 @@ function do_text_id() {
}
}
function do_namespace_size() {
$tables = array(
'page' => 'page',
'archive' => 'ar',
'recentchanges' => 'rc',
'watchlist' => 'wl',
'querycache' => 'qc',
'logging' => 'log',
);
foreach( $tables as $table => $prefix ) {
do_namespace_size_on( $table, $prefix );
flush();
}
}
function do_namespace_size_on( $table, $prefix ) {
global $wgDatabase;
$field = $prefix . '_namespace';
$tablename = $wgDatabase->tableName( $table );
$result = $wgDatabase->query( "SHOW COLUMNS FROM $tablename LIKE '$field'" );
$info = $wgDatabase->fetchObject( $result );
$wgDatabase->freeResult( $result );
if( substr( $info->Type, 0, 3 ) == 'int' ) {
echo "...$field is already a full int ($info->Type).\n";
} else {
echo "Promoting $field from $info->Type to int... ";
$sql = "ALTER TABLE $tablename MODIFY $field int NOT NULL";
$wgDatabase->query( $sql );
echo "ok\n";
}
}
function do_all_updates() {
global $wgNewTables, $wgNewFields;
@ -470,6 +505,7 @@ function do_all_updates() {
do_schema_restructuring(); flush();
do_inverse_timestamp(); flush();
do_text_id(); flush();
do_namespace_size(); flush();
initialiseMessages(); flush();
}