MDL-46171 Assign: Add "latest" column + index to submission table.

This commit is contained in:
Damyon Wiese 2014-07-24 11:50:18 +08:00
parent d3e70202fc
commit 587341138f
8 changed files with 29 additions and 1 deletions

0
mod/assign/db/access.php Normal file → Executable file
View File

0
mod/assign/db/install.xml Normal file → Executable file
View File

0
mod/assign/db/log.php Normal file → Executable file
View File

0
mod/assign/db/messages.php Normal file → Executable file
View File

0
mod/assign/db/services.php Normal file → Executable file
View File

0
mod/assign/db/subplugins.php Normal file → Executable file
View File

28
mod/assign/db/upgrade.php Normal file → Executable file
View File

@ -495,6 +495,34 @@ function xmldb_assign_upgrade($oldversion) {
// Assign savepoint reached.
upgrade_mod_savepoint(true, 2014051201, 'assign');
}
if ($oldversion < 2014072400) {
// Add "latest" column to submissions table to mark the latest attempt.
$table = new xmldb_table('assign_submission');
$field = new xmldb_field('latest', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'attemptnumber');
// Conditionally launch add field latest.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Assign savepoint reached.
upgrade_mod_savepoint(true, 2014072400, 'assign');
}
if ($oldversion < 2014072401) {
// Define index latestattempt (not unique) to be added to assign_submission.
$table = new xmldb_table('assign_submission');
$index = new xmldb_index('latestattempt', XMLDB_INDEX_NOTUNIQUE, array('assignment', 'userid', 'groupid', 'latest'));
// Conditionally launch add index latestattempt.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Assign savepoint reached.
upgrade_mod_savepoint(true, 2014072401, 'assign');
}
return true;
}

View File

@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
$plugin->version = 2014072200; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2014072401; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2014050800; // Requires this Moodle version.
$plugin->cron = 60;