Skip to content

Commit e271f6c

Browse files
committed
MDLSITE-6243 Do not attempt to create tables if they already exist
1 parent 809e9f8 commit e271f6c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

db/upgrade.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,15 @@ function xmldb_local_amos_upgrade($oldversion) {
347347

348348
if ($oldversion < 2019040902) {
349349
// Create the new tables to store the English strings and their translations.
350-
$dbman->install_one_table_from_xmldb_file($CFG->dirroot.'/local/amos/db/install.xml', 'amos_strings');
351-
$dbman->install_one_table_from_xmldb_file($CFG->dirroot.'/local/amos/db/install.xml', 'amos_translations');
350+
351+
if (!$dbman->table_exists(new xmldb_table('amos_strings'))) {
352+
$dbman->install_one_table_from_xmldb_file($CFG->dirroot.'/local/amos/db/install.xml', 'amos_strings');
353+
}
354+
355+
if (!$dbman->table_exists(new xmldb_table('amos_translations'))) {
356+
$dbman->install_one_table_from_xmldb_file($CFG->dirroot.'/local/amos/db/install.xml', 'amos_translations');
357+
}
358+
352359
upgrade_plugin_savepoint(true, 2019040902, 'local', 'amos');
353360
}
354361

0 commit comments

Comments
 (0)