Skip to content

Commit 12d8122

Browse files
aspark21mdjnelson
authored andcommitted
Add field exist check for alignment field
1 parent 311e243 commit 12d8122

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

db/upgrade.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ function xmldb_customcert_upgrade($oldversion) {
182182
$table = new xmldb_table('customcert_elements');
183183
$field = new xmldb_field('alignment', XMLDB_TYPE_CHAR, '1', null, XMLDB_NOTNULL, null, 'L', 'refpoint');
184184

185-
$dbman->add_field($table, $field);
185+
// Conditionally launch add field.
186+
if (!$dbman->field_exists($table, $field)) {
187+
$dbman->add_field($table, $field);
188+
}
186189

187190
upgrade_mod_savepoint(true, 2021051702, 'customcert'); // Replace with the actual version number.
188191
}

0 commit comments

Comments
 (0)