Commit aa797e33 authored by Astor Bizard's avatar Astor Bizard
Browse files

Refactored upgrade.php (while it still has no impact).

parent 58f6e37b
......@@ -323,7 +323,7 @@ function xmldb_vpl_upgrade($oldversion = 0) {
// VPL savepoint reached.
upgrade_mod_savepoint( true, 2018011314, 'vpl' );
}
if ($oldversion < 2021052600) {
if ($oldversion < 2021061600) {
// Define table vpl_overrides to be created.
$table = new xmldb_table('vpl_overrides');
......@@ -331,8 +331,6 @@ function xmldb_vpl_upgrade($oldversion = 0) {
// Adding fields to table vpl_overrides.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('vpl', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
$table->add_field('userids', XMLDB_TYPE_TEXT, null, null, null, null, null);
$table->add_field('groupids', XMLDB_TYPE_TEXT, null, null, null, null, null);
$table->add_field('startdate', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
$table->add_field('duedate', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
$table->add_field('freeevaluations', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
......@@ -341,30 +339,14 @@ function xmldb_vpl_upgrade($oldversion = 0) {
// Adding keys to table vpl_overrides.
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
// Adding indexes to table vpl_assigned_overrides.
$table->add_index('vpl', XMLDB_INDEX_NOTUNIQUE, ['vpl']);
// Conditionally launch create table for vpl_overrides.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Vpl savepoint reached.
upgrade_mod_savepoint(true, 2021052600, 'vpl');
}
if ($oldversion < 2021061400) {
// Define index vpl (not unique) to be added to vpl_overrides.
$table = new xmldb_table('vpl_overrides');
$index = new xmldb_index('vpl', XMLDB_INDEX_NOTUNIQUE, ['vpl']);
// Conditionally launch add index vpl.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Vpl savepoint reached.
upgrade_mod_savepoint(true, 2021061400, 'vpl');
}
if ($oldversion < 2021061600) {
// Define table vpl_assigned_overrides to be created.
$table = new xmldb_table('vpl_assigned_overrides');
......@@ -387,23 +369,6 @@ function xmldb_vpl_upgrade($oldversion = 0) {
$dbman->create_table($table);
}
// Define field userids to be dropped from vpl_overrides.
$table = new xmldb_table('vpl_overrides');
$field = new xmldb_field('userids');
// Conditionally launch drop field userids.
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}
// Define field groupids to be dropped from vpl_overrides.
$field = new xmldb_field('groupids');
// Conditionally launch drop field groupids.
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}
// Vpl savepoint reached.
upgrade_mod_savepoint(true, 2021061600, 'vpl');
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment