Skip to content

Commit

Permalink
Add missing foreign key relationship (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjnelson committed Jan 8, 2024
1 parent c89c18f commit 05ea571
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for customcert_issues"/>
<KEY NAME="user" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
<KEY NAME="customcert" TYPE="foreign" FIELDS="customcertid" REFTABLE="customcert" REFFIELDS="id"/>
</KEYS>
<INDEXES>
Expand Down
9 changes: 9 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,14 @@ function xmldb_customcert_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2022112802, 'customcert'); // Replace with the actual version number.
}

if ($oldversion < 2022112803) {
$table = new xmldb_table('customcert_issues');
$key = new xmldb_key('userid', XMLDB_KEY_FOREIGN, ['userid'], 'user', ['id']);

$dbman->add_key($table, $key);

upgrade_mod_savepoint(true, 2022112803, 'customcert');
}

return true;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');

$plugin->version = 2022112802; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2022112803; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2022112800; // Requires this Moodle version (4.1).
$plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->component = 'mod_customcert';
Expand Down

0 comments on commit 05ea571

Please sign in to comment.