diff --git a/db/upgrade.php b/db/upgrade.php index 701e819f..53ad7584 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -182,7 +182,10 @@ function xmldb_customcert_upgrade($oldversion) { $table = new xmldb_table('customcert_elements'); $field = new xmldb_field('alignment', XMLDB_TYPE_CHAR, '1', null, XMLDB_NOTNULL, null, 'L', 'refpoint'); - $dbman->add_field($table, $field); + // Conditionally launch add field. + if (!$dbman->field_exists($table, $field)) { + $dbman->add_field($table, $field); + } upgrade_mod_savepoint(true, 2021051702, 'customcert'); // Replace with the actual version number. }