Permalink
Browse files

Wiki: correct column type on Postgres update (fixes Search and Links …

…tabs, matches what's in install.xml anyhow)
  • Loading branch information...
1 parent 2285016 commit 13ef403f3b2dff252191db7739f3ed515a73cbea sam_marshall committed Sep 27, 2006
Showing with 13 additions and 1 deletion.
  1. +12 −0 mod/wiki/db/postgres7.php
  2. +1 −1 mod/wiki/version.php
View
@@ -170,6 +170,18 @@ function wiki_upgrade($oldversion) {
modify_database("","CREATE INDEX prefix_wikilock_loc_ix ON prefix_wiki_locks (lockedseen);");
modify_database("","CREATE UNIQUE INDEX prefix_wikilock_wikpag_uix ON prefix_wiki_locks (wikiid, pagename);");
}
+
+ if($oldversion < 2006092602) {
+ // 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 refs SET DEFAULT '';");
+ // ...and this one broke the search page.
+ 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 '';");
+ }
return true;
}
View
@@ -5,7 +5,7 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2006092502; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2006092602; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2006080900; // The current module version (Date: YYYYMMDDXX)
$module->cron = 3600; // Period for cron to check this module (secs)

0 comments on commit 13ef403

Please sign in to comment.