}
if($oldversion < 2006092602) {
- // This used to be a BYTEA type for no apparent reason, which caused various queries to fail. The new
+/*
+ // This used to be a BYTEA type for no apparent reason, which caused various queries to fail. The new
// install.xml uses TEXT so I figure it's safe to change it in upgrade too. This one broke the links page...
modify_database('',"ALTER TABLE prefix_wiki_pages ALTER COLUMN refs DROP DEFAULT;");
modify_database('',"ALTER TABLE prefix_wiki_pages ALTER COLUMN refs TYPE TEXT USING ENCODE(refs,'escape');");
modify_database('',"ALTER TABLE prefix_wiki_pages ALTER COLUMN content DROP DEFAULT;");
modify_database('',"ALTER TABLE prefix_wiki_pages ALTER COLUMN content TYPE TEXT USING ENCODE(content,'escape');");
modify_database('',"ALTER TABLE prefix_wiki_pages ALTER COLUMN content SET DEFAULT '';");
+*/
+ // following code should be compatible with both pg 8.x and 7.4
+ table_column('wiki_pages', '', 'tempcontent', 'TEXT', '', '', '', '');
+ execute_sql("UPDATE {$CFG->prefix}wiki_pages SET tempcontent = ENCODE(content,'escape')");
+ execute_sql("ALTER TABLE {$CFG->prefix}wiki_pages DROP COLUMN content");
+ execute_sql("ALTER TABLE {$CFG->prefix}wiki_pages RENAME COLUMN tempcontent TO content");
+
+ table_column('wiki_pages', '', 'temprefs', 'TEXT', '', '', '', '');
+ execute_sql("UPDATE {$CFG->prefix}wiki_pages SET temprefs = ENCODE(refs,'escape')");
+ execute_sql("ALTER TABLE {$CFG->prefix}wiki_pages DROP COLUMN refs");
+ execute_sql("ALTER TABLE {$CFG->prefix}wiki_pages RENAME COLUMN temprefs TO refs");
+
}
return true;