|
|
@ -360,7 +360,6 @@ function xmldb_attendance_upgrade($oldversion=0) { |
|
|
|
|
|
|
|
// Adding keys to table attendance_warning. |
|
|
|
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); |
|
|
|
$table->add_key('level_id', XMLDB_KEY_UNIQUE, array('idnumber, warningpercent')); |
|
|
|
|
|
|
|
// Conditionally launch create table for attendance_warning. |
|
|
|
if (!$dbman->table_exists($table)) { |
|
|
@ -397,5 +396,18 @@ function xmldb_attendance_upgrade($oldversion=0) { |
|
|
|
upgrade_mod_savepoint(true, 2017062000, 'attendance'); |
|
|
|
} |
|
|
|
|
|
|
|
if ($oldversion < 2017071301) { |
|
|
|
// Fix key. |
|
|
|
$table = new xmldb_table('attendance_warning'); |
|
|
|
if ($table->getkey('level_id')) { |
|
|
|
$table->deleteKey('level_id'); |
|
|
|
} |
|
|
|
$key = new xmldb_key('level_id', XMLDB_KEY_UNIQUE, array('idnumber, warningpercent, warnafter')); |
|
|
|
$dbman->add_key($table, $key); |
|
|
|
|
|
|
|
// Attendance savepoint reached. |
|
|
|
upgrade_mod_savepoint(true, 2017071301, 'attendance'); |
|
|
|
} |
|
|
|
|
|
|
|
return $result; |
|
|
|
} |
|
|
|