Skip to content

Commit

Permalink
Make index not unique (#537)
Browse files Browse the repository at this point in the history
The reason for this is because there may be plans
to extend this plugin to allow for multiple
certificate issues.

Also, there was a bug that allowed for duplicate
issues which was resolved but those issues could
still exist in users' databases. Instead of creating
an upgrade path to delete them just leave it for now.
  • Loading branch information
mdjnelson committed Jan 8, 2024
1 parent c4dca14 commit ea2b38f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<KEY NAME="customcert" TYPE="foreign" FIELDS="customcertid" REFTABLE="customcert" REFFIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="userid-customcertid" UNIQUE="true" FIELDS="userid, customcertid"/>
<INDEX NAME="userid-customcertid" UNIQUE="false" FIELDS="userid, customcertid"/>
</INDEXES>
</TABLE>
<TABLE NAME="customcert_pages" COMMENT="Stores each page of a custom cert">
Expand Down
2 changes: 1 addition & 1 deletion db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function xmldb_customcert_upgrade($oldversion) {
if ($oldversion < 2023042403) {
// Define index to be added to customcert_issues.
$table = new xmldb_table('customcert_issues');
$index = new xmldb_index('userid-customcertid', XMLDB_INDEX_UNIQUE, ['userid', 'customcertid']);
$index = new xmldb_index('userid-customcertid', XMLDB_INDEX_NOTUNIQUE, ['userid', 'customcertid']);

// Conditionally launch add index.
if (!$dbman->index_exists($table, $index)) {
Expand Down

0 comments on commit ea2b38f

Please sign in to comment.