Skip to content

Commit

Permalink
Merge pull request #160 from catalyst/fix-schema-for-upgrades
Browse files Browse the repository at this point in the history
Add missing foreign key for 'stepconfigid' upgrades
  • Loading branch information
Peterburnett authored Nov 23, 2021
2 parents 151ea4d + c1f3f5a commit 9e18ab3
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 9e18ab3

Please sign in to comment.