Merge branch 'MDL-49543' of https://github.com/totara/openbadges
[moodle.git] / lib / db / upgrade.php
index ab1e714..f5461f7 100644 (file)
@@ -4252,5 +4252,23 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2015031900.01);
     }
 
+    if ($oldversion < 2015032000.00) {
+        $table = new xmldb_table('badge_criteria');
+
+        $field = new xmldb_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null);
+        // Conditionally add description field to the badge_criteria table.
+        if (!$dbman->field_exists($table, $field)) {
+            $dbman->add_field($table, $field);
+        }
+
+        $field = new xmldb_field('descriptionformat', XMLDB_TYPE_INTEGER, 2, null, XMLDB_NOTNULL, null, 0);
+        // Conditionally add description format field to the badge_criteria table.
+        if (!$dbman->field_exists($table, $field)) {
+            $dbman->add_field($table, $field);
+        }
+
+        upgrade_main_savepoint(true, 2015032000.00);
+    }
+
     return true;
 }