Skip to content

Commit

Permalink
Add missing foreign key for 'stepconfigid' upgrades
Browse files Browse the repository at this point in the history
Issue when upgrading from a lower version - started from 01950e6
  • Loading branch information
keevan committed Nov 23, 2021
1 parent 151ea4d commit c1f3f5a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,5 +337,20 @@ function xmldb_tool_trigger_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2021030403, 'tool', 'trigger');
}

if ($oldversion < 2021030404) {

// Define key stepconfigid (foreign) to be added to tool_trigger_run_hist.
$table = new xmldb_table('tool_trigger_run_hist');
$key = new xmldb_key('stepconfigid', XMLDB_KEY_FOREIGN, ['stepconfigid'], 'tool_trigger_steps', ['id']);

// Launch add key stepconfigid.
if (!$table->getKey($key->getName())) {
$dbman->add_key($table, $key);
}

// Trigger savepoint reached.
upgrade_plugin_savepoint(true, 2021030404, 'tool', 'trigger');
}

return true;
}
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'tool_trigger';
$plugin->release = 2021030403;
$plugin->version = 2021030403;
$plugin->release = 2021030404;
$plugin->version = 2021030404;
$plugin->requires = 2016052300;
$plugin->maturity = MATURITY_STABLE;
$plugin->dependencies = array('tool_monitor' => 2015051101);

0 comments on commit c1f3f5a

Please sign in to comment.