Recent wiki table changes have problems on PostgreSQL 7.4 MDL-6724

This commit is contained in:
skodak
2006-10-01 12:04:34 +00:00
parent c536c6b04c
commit ea580cdfa6
+14 -1
View File
@@ -172,7 +172,8 @@ CREATE TABLE prefix_wiki_locks
}
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');");
@@ -181,6 +182,18 @@ CREATE TABLE prefix_wiki_locks
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;