mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 18:36:42 +02:00
MDL-18577 drop enums support - step2: enums out from editor, dbmanager and all upgrade scripts.
This commit is contained in:
parent
3ece3e4273
commit
2a88f626f7
32 changed files with 348 additions and 677 deletions
|
@ -34,9 +34,9 @@ function xmldb_quiz_upgrade($oldversion) {
|
|||
$table = new xmldb_table('quiz_report');
|
||||
|
||||
/// Adding fields to table quiz_report
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
||||
$table->add_field('name', XMLDB_TYPE_CHAR, '255', null, null, null, null, null, null);
|
||||
$table->add_field('displayorder', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('name', XMLDB_TYPE_CHAR, '255', null, null, null, null);
|
||||
$table->add_field('displayorder', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
|
||||
|
||||
/// Adding keys to table quiz_report
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
|
@ -82,7 +82,7 @@ function xmldb_quiz_upgrade($oldversion) {
|
|||
|
||||
/// Define field lastcron to be added to quiz_report
|
||||
$table = new xmldb_table('quiz_report');
|
||||
$field = new xmldb_field('lastcron', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'displayorder');
|
||||
$field = new xmldb_field('lastcron', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'displayorder');
|
||||
|
||||
/// Conditionally launch add field lastcron
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
|
@ -90,7 +90,7 @@ function xmldb_quiz_upgrade($oldversion) {
|
|||
}
|
||||
|
||||
/// Define field cron to be added to quiz_report
|
||||
$field = new xmldb_field('cron', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'lastcron');
|
||||
$field = new xmldb_field('cron', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'lastcron');
|
||||
|
||||
/// Conditionally launch add field cron
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
|
@ -123,49 +123,49 @@ function xmldb_quiz_upgrade($oldversion) {
|
|||
/// Changing the type of all the columns that store grades to be NUMBER(10, 5) or similar.
|
||||
if ($result && $oldversion < 2008081501) {
|
||||
$table = new xmldb_table('quiz');
|
||||
$field = new xmldb_field('sumgrades', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, null, null, 'questions');
|
||||
$field = new xmldb_field('sumgrades', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, 'questions');
|
||||
$dbman->change_field_type($table, $field);
|
||||
upgrade_mod_savepoint($result, 2008081501, 'quiz');
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2008081502) {
|
||||
$table = new xmldb_table('quiz');
|
||||
$field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, null, null, 'sumgrades');
|
||||
$field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, 'sumgrades');
|
||||
$dbman->change_field_type($table, $field);
|
||||
upgrade_mod_savepoint($result, 2008081502, 'quiz');
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2008081503) {
|
||||
$table = new xmldb_table('quiz_attempts');
|
||||
$field = new xmldb_field('sumgrades', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, null, null, 'attempt');
|
||||
$field = new xmldb_field('sumgrades', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, 'attempt');
|
||||
$dbman->change_field_type($table, $field);
|
||||
upgrade_mod_savepoint($result, 2008081503, 'quiz');
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2008081504) {
|
||||
$table = new xmldb_table('quiz_feedback');
|
||||
$field = new xmldb_field('mingrade', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, null, null, 'feedbacktext');
|
||||
$field = new xmldb_field('mingrade', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, 'feedbacktext');
|
||||
$dbman->change_field_type($table, $field);
|
||||
upgrade_mod_savepoint($result, 2008081504, 'quiz');
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2008081505) {
|
||||
$table = new xmldb_table('quiz_feedback');
|
||||
$field = new xmldb_field('maxgrade', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, null, null, 'mingrade');
|
||||
$field = new xmldb_field('maxgrade', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, 'mingrade');
|
||||
$dbman->change_field_type($table, $field);
|
||||
upgrade_mod_savepoint($result, 2008081505, 'quiz');
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2008081506) {
|
||||
$table = new xmldb_table('quiz_grades');
|
||||
$field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, null, null, 'userid');
|
||||
$field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, 'userid');
|
||||
$dbman->change_field_type($table, $field);
|
||||
upgrade_mod_savepoint($result, 2008081506, 'quiz');
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2008081507) {
|
||||
$table = new xmldb_table('quiz_question_instances');
|
||||
$field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, null, null, 'question');
|
||||
$field = new xmldb_field('grade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, 'question');
|
||||
$dbman->change_field_type($table, $field);
|
||||
upgrade_mod_savepoint($result, 2008081507, 'quiz');
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ function xmldb_quiz_upgrade($oldversion) {
|
|||
|
||||
/// Define field lastcron to be added to quiz_report
|
||||
$table = new xmldb_table('quiz_report');
|
||||
$field = new xmldb_field('capability', XMLDB_TYPE_CHAR, '255', null, null, null, null, null, null, 'cron');
|
||||
$field = new xmldb_field('capability', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'cron');
|
||||
|
||||
/// Conditionally launch add field lastcron
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
|
@ -216,7 +216,7 @@ function xmldb_quiz_upgrade($oldversion) {
|
|||
|
||||
/// Define field showuserpicture to be added to quiz
|
||||
$table = new xmldb_table('quiz');
|
||||
$field = new xmldb_field('showuserpicture', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, null, null, '0', 'delay2');
|
||||
$field = new xmldb_field('showuserpicture', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', 'delay2');
|
||||
|
||||
/// Conditionally launch add field showuserpicture
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
|
@ -257,7 +257,7 @@ function xmldb_quiz_upgrade($oldversion) {
|
|||
if ($result && $oldversion < 2009031000) {
|
||||
/// Add new questiondecimaldigits setting, separate form the overall decimaldigits one.
|
||||
$table = new xmldb_table('quiz');
|
||||
$field = new xmldb_field('questiondecimalpoints', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, null, null, '2', 'decimalpoints');
|
||||
$field = new xmldb_field('questiondecimalpoints', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '2', 'decimalpoints');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ function xmldb_quiz_upgrade($oldversion) {
|
|||
|
||||
/// Define field introformat to be added to quiz
|
||||
$table = new xmldb_table('quiz');
|
||||
$field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
|
||||
$field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro');
|
||||
|
||||
/// Launch add field introformat
|
||||
$dbman->add_field($table, $field);
|
||||
|
|
|
@ -14,13 +14,13 @@ function xmldb_quizreport_overview_upgrade($oldversion) {
|
|||
$table = new xmldb_table('quiz_question_regrade');
|
||||
|
||||
/// Adding fields to table quiz_question_regrade
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
||||
$table->add_field('questionid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_field('attemptid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_field('newgrade', XMLDB_TYPE_NUMBER, '10, 5', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_field('oldgrade', XMLDB_TYPE_NUMBER, '10, 5', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_field('regraded', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('questionid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('attemptid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('newgrade', XMLDB_TYPE_NUMBER, '10, 5', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('oldgrade', XMLDB_TYPE_NUMBER, '10, 5', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('regraded', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
|
||||
|
||||
/// Adding keys to table quiz_question_regrade
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
|
@ -34,19 +34,19 @@ function xmldb_quizreport_overview_upgrade($oldversion) {
|
|||
if ($result && $oldversion < 2009030500) {
|
||||
/// Changing precision of field newgrade on table quiz_question_regrade to (12, 7).
|
||||
$table = new xmldb_table('quiz_question_regrade');
|
||||
$field = new xmldb_field('newgrade', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, null, null, null, 'attemptid');
|
||||
$field = new xmldb_field('newgrade', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, null, 'attemptid');
|
||||
|
||||
/// Launch change of precision for field newgrade
|
||||
$dbman->change_field_precision($table, $field);
|
||||
|
||||
/// Changing precision of field oldgrade on table quiz_question_regrade to (12, 7).
|
||||
$table = new xmldb_table('quiz_question_regrade');
|
||||
$field = new xmldb_field('oldgrade', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, null, null, null, 'newgrade');
|
||||
$field = new xmldb_field('oldgrade', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, null, 'newgrade');
|
||||
|
||||
/// Launch change of precision for field newgrade
|
||||
$dbman->change_field_precision($table, $field);
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
|
|||
|
||||
/// Define field s to be added to quiz_question_statistics
|
||||
$table = new xmldb_table('quiz_question_statistics');
|
||||
$field = new xmldb_field('s', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'subquestion');
|
||||
$field = new xmldb_field('s', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'subquestion');
|
||||
|
||||
/// Conditionally launch add field s
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
|
@ -30,7 +30,7 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
|
|||
|
||||
/// Define field maxgrade to be added to quiz_question_statistics
|
||||
$table = new xmldb_table('quiz_question_statistics');
|
||||
$field = new xmldb_field('maxgrade', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null, 'subquestions');
|
||||
$field = new xmldb_field('maxgrade', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, 'subquestions');
|
||||
|
||||
/// Conditionally launch add field maxgrade
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
|
@ -43,7 +43,7 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
|
|||
|
||||
/// Define field positions to be added to quiz_question_statistics
|
||||
$table = new xmldb_table('quiz_question_statistics');
|
||||
$field = new xmldb_field('positions', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, null, null, 'maxgrade');
|
||||
$field = new xmldb_field('positions', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'maxgrade');
|
||||
|
||||
/// Conditionally launch add field positions
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
|
@ -55,7 +55,7 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
|
|||
if ($result && $oldversion < 2008081500) {
|
||||
/// Changing type of field maxgrade on table quiz_question_statistics to number
|
||||
$table = new xmldb_table('quiz_question_statistics');
|
||||
$field = new xmldb_field('maxgrade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, null, null, 'subquestions');
|
||||
$field = new xmldb_field('maxgrade', XMLDB_TYPE_NUMBER, '12, 7', null, null, null, null, 'subquestions');
|
||||
|
||||
/// Launch change of type for field maxgrade
|
||||
$dbman->change_field_type($table, $field);
|
||||
|
@ -67,13 +67,13 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
|
|||
$table = new xmldb_table('quiz_question_response_stats');
|
||||
|
||||
/// Adding fields to table quiz_question_response_stats
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
||||
$table->add_field('quizstatisticsid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_field('questionid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_field('anssubqid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null);
|
||||
$table->add_field('response', XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, null);
|
||||
$table->add_field('rcount', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null);
|
||||
$table->add_field('credit', XMLDB_TYPE_NUMBER, '15, 5', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('quizstatisticsid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('questionid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('anssubqid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null);
|
||||
$table->add_field('response', XMLDB_TYPE_TEXT, 'big', null, null, null, null);
|
||||
$table->add_field('rcount', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null);
|
||||
$table->add_field('credit', XMLDB_TYPE_NUMBER, '15, 5', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
|
||||
|
||||
/// Adding keys to table quiz_question_response_stats
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
|
@ -101,7 +101,7 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
|
|||
}
|
||||
|
||||
/// Define field subqid to be added to quiz_question_response_stats
|
||||
$field = new xmldb_field('subqid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'questionid');
|
||||
$field = new xmldb_field('subqid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, 'questionid');
|
||||
|
||||
/// Conditionally launch add field subqid
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
|
@ -109,7 +109,7 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
|
|||
}
|
||||
|
||||
/// Define field aid to be added to quiz_question_response_stats
|
||||
$field = new xmldb_field('aid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'subqid');
|
||||
$field = new xmldb_field('aid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, 'subqid');
|
||||
|
||||
/// Conditionally launch add field aid
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
|
@ -126,7 +126,7 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
|
|||
/// Define field anssubqid to be dropped from quiz_question_response_stats
|
||||
$table = new xmldb_table('quiz_question_statistics');
|
||||
/// Define field subqid to be added to quiz_question_response_stats
|
||||
$field = new xmldb_field('negcovar', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'effectiveweight');
|
||||
$field = new xmldb_field('negcovar', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'effectiveweight');
|
||||
|
||||
/// Conditionally launch add field subqid
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue