MDL-51939 mod_forum: Fix groupid data on upgrade
[moodle.git] / mod / forum / db / upgrade.php
index ec874df..f68498f 100644 (file)
@@ -242,6 +242,13 @@ function xmldb_forum_upgrade($oldversion) {
 
     // Moodle v2.9.0 release upgrade line.
     // Put any upgrade step following this.
+    if ($oldversion < 2015102900) {
+        // Groupid = 0 is never valid.
+        $DB->set_field('forum_discussions', 'groupid', -1, array('groupid' => 0));
+
+        // Forum savepoint reached.
+        upgrade_mod_savepoint(true, 2015102900, 'forum');
+    }
 
     return true;
 }