r26209 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26208‎ | r26209 | r26210 >
Date:14:03, 28 September 2007
Author:greg
Status:old
Tags:
Comment:
Use same typnames as schema for ease. Put added column before column type checks.
Modified paths:
  • /trunk/phase3/includes/DatabasePostgres.php (modified) (history)
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/updaters.inc
@@ -1353,29 +1353,29 @@
13541354 $typechanges = array(
13551355 array("archive", "ar_deleted", "smallint", ""),
13561356 array("filearchive", "fa_deleted", "smallint", ""),
1357 - array("filearchive", "fa_metadata", "bytea", "decode(fa_metadata,'escape')"),
1358 - array("filearchive", "fa_size", "int4", ""),
1359 - array("filearchive", "fa_storage_group","text", ""),
1360 - array("filearchive", "fa_storage_key", "text", ""),
1361 - array("image", "img_metadata", "bytea", "decode(img_metadata,'escape')"),
1362 - array("image", "img_size", "int4", ""),
1363 - array("image", "img_width", "int4", ""),
1364 - array("image", "img_height", "int4", ""),
1365 - array("ipblocks", "ipb_address", "text", "ipb_address::text"),
1366 - array("ipblocks", "ipb_deleted", "char", ""),
1367 - array("math", "math_inputhash", "bytea", "decode(math_inputhash,'escape')"),
1368 - array("math", "math_outputhash", "bytea", "decode(math_outputhash,'escape')"),
1369 - array("mwuser", "user_token", "text", ""),
1370 - array("mwuser", "user_email_token","text", ""),
1371 - array("objectcache", "keyname", "text", ""),
1372 - array("oldimage", "oi_height", "int4", ""),
1373 - array("oldimage", "oi_size", "int4", ""),
1374 - array("oldimage", "oi_width", "int4", ""),
1375 - array("querycache", "qc_value", "int4", ""),
1376 - array("querycachetwo","qcc_value", "int4", ""),
 1357+ array("filearchive", "fa_metadata", "bytea", "decode(fa_metadata,'escape')"),
 1358+ array("filearchive", "fa_size", "integer", ""),
 1359+ array("filearchive", "fa_storage_group","text", ""),
 1360+ array("filearchive", "fa_storage_key", "text", ""),
 1361+ array("image", "img_metadata", "bytea", "decode(img_metadata,'escape')"),
 1362+ array("image", "img_size", "integer", ""),
 1363+ array("image", "img_width", "integer", ""),
 1364+ array("image", "img_height", "integer", ""),
 1365+ array("ipblocks", "ipb_address", "text", "ipb_address::text"),
 1366+ array("ipblocks", "ipb_deleted", "char", ""),
 1367+ array("math", "math_inputhash", "bytea", "decode(math_inputhash,'escape')"),
 1368+ array("math", "math_outputhash", "bytea", "decode(math_outputhash,'escape')"),
 1369+ array("mwuser", "user_token", "text", ""),
 1370+ array("mwuser", "user_email_token","text", ""),
 1371+ array("objectcache", "keyname", "text", ""),
 1372+ array("oldimage", "oi_height", "integer", ""),
 1373+ array("oldimage", "oi_size", "integer", ""),
 1374+ array("oldimage", "oi_width", "integer", ""),
 1375+ array("querycache", "qc_value", "integer", ""),
 1376+ array("querycachetwo","qcc_value", "integer", ""),
13771377 array("recentchanges","rc_deleted", "smallint", ""),
13781378 array("templatelinks","tl_namespace", "smallint", "tl_namespace::smallint"),
1379 - array("user_newtalk", "user_ip", "text", "host(user_ip)"),
 1379+ array("user_newtalk", "user_ip", "text", "host(user_ip)"),
13801380 );
13811381
13821382 $newindexes = array(
@@ -1435,6 +1435,13 @@
14361436 $wgDatabase->query("ALTER TABLE $nc[0] ADD $nc[1] $nc[2]");
14371437 }
14381438
 1439+ ## Needed before column changes
 1440+ if (is_null($wgDatabase->fieldInfo("archive", "ar_deleted"))) {
 1441+ echo "... add archive.ar_deleted\n";
 1442+ dbsource(archive("patch-archive-ar_deleted.sql"));
 1443+ } else
 1444+ echo "... archive.ar_deleted already exists\n";
 1445+
14391446 foreach ($typechanges as $tc) {
14401447 $fi = $wgDatabase->fieldInfo($tc[0], $tc[1]);
14411448 if (is_null($fi)) {
@@ -1455,7 +1462,7 @@
14561463 }
14571464 }
14581465
1459 - if ($wgDatabase->fieldInfo('oldimage','oi_deleted') !== 'smallint') {
 1466+ if ($wgDatabase->fieldInfo('oldimage','oi_deleted')->type() !== 'smallint') {
14601467 echo "... change oldimage.oi_deleted to smallint";
14611468 $wgDatabase->query("ALTER TABLE oldimage ALTER oi_deleted DROP DEFAULT");
14621469 $wgDatabase->query("ALTER TABLE oldimage ALTER oi_deleted TYPE SMALLINT USING (oi_deleted::smallint)");
@@ -1518,12 +1525,6 @@
15191526 dbsource(archive('patch-revision_rev_user_fkey.sql'));
15201527 }
15211528
1522 - if (is_null($wgDatabase->fieldInfo("archive", "ar_deleted"))) {
1523 - echo "... add archive.ar_deleted\n";
1524 - dbsource(archive("patch-archive-ar_deleted.sql"));
1525 - } else
1526 - echo "... archive.ar_deleted already exists\n";
1527 -
15281529 global $wgExtNewTables, $wgExtPGNewFields, $wgExtNewIndexes;
15291530 # Add missing extension tables
15301531 foreach ( $wgExtNewTables as $nt ) {
Index: trunk/phase3/includes/DatabasePostgres.php
@@ -16,7 +16,12 @@
1717 global $wgDBmwschema;
1818
1919 $q = <<<END
20 -SELECT typname, attnotnull, attlen
 20+SELECT
 21+CASE WHEN typname = 'int2' THEN 'smallint'
 22+WHEN typname = 'int4' THEN 'integer'
 23+WHEN typname = 'int8' THEN 'bigint'
 24+ELSE typname END AS typname,
 25+attnotnull, attlen
2126 FROM pg_class, pg_namespace, pg_attribute, pg_type
2227 WHERE relnamespace=pg_namespace.oid
2328 AND relkind='r'

Follow-up revisions

RevisionCommit summaryAuthorDate
r26257Merged revisions 26134-26247 via svnmerge from...david19:06, 30 September 2007

Status & tagging log