]> git.mjollnir.org Git - moodle.git/commitdiff
Wiki: correct column type on Postgres update (fixes Search and Links tabs, matches...
authorsam_marshall <sam_marshall>
Wed, 27 Sep 2006 11:21:01 +0000 (11:21 +0000)
committersam_marshall <sam_marshall>
Wed, 27 Sep 2006 11:21:01 +0000 (11:21 +0000)
mod/wiki/db/postgres7.php
mod/wiki/version.php

index 2d89821c3379817658cc5b21fbf78c3ae6109d57..5790cf395182c8a80185a8a6391280de55961de1 100644 (file)
@@ -170,6 +170,18 @@ CREATE TABLE prefix_wiki_locks
         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;
 }
index 392193bc7673388de31e73d34d2375d569589058..fd4b35409d01b9da59df5825e9fa2444670e7372 100644 (file)
@@ -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)