Skip to content

Commit

Permalink
Merge pull request #134 from dmitriim/issue133
Browse files Browse the repository at this point in the history
issue #133: delete unique index (take 2)
  • Loading branch information
danmarsden authored Nov 27, 2023
2 parents 40be9f3 + e1357e4 commit ce56eb4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 0 additions & 1 deletion db/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
</KEYS>
<INDEXES>
<INDEX NAME="coursemoduleid" UNIQUE="false" FIELDS="coursemoduleid" COMMENT="For quick access via course-module (e.g. when displaying course module settings page and we need to determine whether anyone has completed it)."/>
<INDEX NAME="userid-coursemoduleid" UNIQUE="true" FIELDS="userid, coursemoduleid"/>
</INDEXES>
</TABLE>
<TABLE NAME="local_recompletion_qa" COMMENT="archive of quiz attempts table">
Expand Down
14 changes: 14 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -973,5 +973,19 @@ function xmldb_local_recompletion_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2023112100, 'local', 'recompletion');
}

if ($oldversion < 2023112600) {
// Define table local_recompletion_cmv to be created.
$table = new xmldb_table('local_recompletion_cmv');
$index = new xmldb_index('userid-coursemoduleid', XMLDB_INDEX_UNIQUE, ['userid', 'coursemoduleid']);

// Conditionally launch drop index.
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}

// Recompletion savepoint reached.
upgrade_plugin_savepoint(true, 2023112600, 'local', 'recompletion');
}

return true;
}
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

defined('MOODLE_INTERNAL') || die;

$plugin->version = 2023112100;
$plugin->release = 2023112100;
$plugin->version = 2023112600;
$plugin->release = 2023112600;
$plugin->maturity = MATURITY_STABLE;
$plugin->requires = 2022112805; // Requires 4.1.
$plugin->component = 'local_recompletion';
Expand Down

0 comments on commit ce56eb4

Please sign in to comment.