MDL-18577 drop enums support - step2: enums out from editor, dbmanager and all upgrade scripts.

This commit is contained in:
stronk7 2009-05-01 01:19:16 +00:00
parent 3ece3e4273
commit 2a88f626f7
32 changed files with 348 additions and 677 deletions

View file

@ -136,7 +136,7 @@ function xmldb_assignment_upgrade($oldversion) {
/// Rename field description on table assignment to intro
$table = new xmldb_table('assignment');
$field = new xmldb_field('description', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null, 'name');
$field = new xmldb_field('description', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'name');
/// Launch rename field description
$dbman->rename_field($table, $field, 'intro');
@ -149,7 +149,7 @@ function xmldb_assignment_upgrade($oldversion) {
/// Rename field format on table assignment to introformat
$table = new xmldb_table('assignment');
$field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
$field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro');
/// Launch rename field format
$dbman->rename_field($table, $field, 'introformat');

View file

@ -34,13 +34,13 @@ function xmldb_chat_upgrade($oldversion) {
$table = new xmldb_table('chat_messages_current');
/// Adding fields to table chat_messages_current
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
$table->add_field('chatid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null, '0');
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null, '0');
$table->add_field('groupid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null, '0');
$table->add_field('system', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
$table->add_field('message', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null);
$table->add_field('timestamp', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0');
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('chatid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
$table->add_field('groupid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
$table->add_field('system', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table->add_field('message', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null);
$table->add_field('timestamp', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
/// Adding keys to table chat_messages_current
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
@ -62,7 +62,7 @@ function xmldb_chat_upgrade($oldversion) {
/// Changing precision of field ip on table chat_users to (45)
$table = new xmldb_table('chat_users');
$field = new xmldb_field('ip', XMLDB_TYPE_CHAR, '45', null, XMLDB_NOTNULL, null, null, null, null, 'version');
$field = new xmldb_field('ip', XMLDB_TYPE_CHAR, '45', null, XMLDB_NOTNULL, null, null, 'version');
/// Launch change of precision for field ip
$dbman->change_field_precision($table, $field);
@ -75,7 +75,7 @@ function xmldb_chat_upgrade($oldversion) {
/// Define field introformat to be added to chat
$table = new xmldb_table('chat');
$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);

View file

@ -32,7 +32,7 @@ function xmldb_choice_upgrade($oldversion) {
/// Rename field text on table choice to NEWNAMEGOESHERE
$table = new xmldb_table('choice');
$field = new xmldb_field('text', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null, 'name');
$field = new xmldb_field('text', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'name');
/// Launch rename field text
$dbman->rename_field($table, $field, 'intro');
@ -45,7 +45,7 @@ function xmldb_choice_upgrade($oldversion) {
/// Rename field format on table choice to NEWNAMEGOESHERE
$table = new xmldb_table('choice');
$field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
$field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro');
/// Launch rename field format
$dbman->rename_field($table, $field, 'introformat');

View file

@ -32,7 +32,7 @@ function xmldb_data_upgrade($oldversion) {
/// Launch add field asearchtemplate again if does not exists yet - reported on several sites
$table = new xmldb_table('data');
$field = new xmldb_field('asearchtemplate', XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'jstemplate');
$field = new xmldb_field('asearchtemplate', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'jstemplate');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
@ -47,7 +47,7 @@ function xmldb_data_upgrade($oldversion) {
$result = $DB->execute($sql);
$table = new xmldb_table('data');
$field = new xmldb_field('notification', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'editany');
$field = new xmldb_field('notification', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'editany');
// First step, Set NOT NULL
$dbman->change_field_notnull($table, $field);
// Second step, Set default to 0
@ -171,7 +171,7 @@ function xmldb_data_upgrade($oldversion) {
/// Define field introformat to be added to data
$table = new xmldb_table('data');
$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);

View file

@ -32,23 +32,23 @@ function xmldb_feedback_upgrade($oldversion) {
$table = new xmldb_table('feedback_completedtmp');
$field = new xmldb_field('id');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, true, null, null, null, null);
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, true, null, null);
$table->addField($field);
$field = new xmldb_field('feedback');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, null, null, '0', null);
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, '0', null);
$table->addField($field);
$field = new xmldb_field('userid');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, null, null, '0', null);
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, '0', null);
$table->addField($field);
$field = new xmldb_field('guestid');
$field->set_attributes(XMLDB_TYPE_CHAR, '255', null, null, false, null, null, '', null);
$field->set_attributes(XMLDB_TYPE_CHAR, '255', null, null, false, '', null);
$table->addField($field);
$field = new xmldb_field('timemodified');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, null, null, '0', null);
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, '0', null);
$table->addField($field);
$key = new xmldb_key('PRIMARY');
@ -66,27 +66,27 @@ function xmldb_feedback_upgrade($oldversion) {
$table = new xmldb_table('feedback_valuetmp');
$field = new xmldb_field('id');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, true, null, null, null, null);
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, true, null, null);
$table->addField($field);
$field = new xmldb_field('course_id');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, null, null, '0', null);
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, '0', null);
$table->addField($field);
$field = new xmldb_field('item');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, null, null, '0', null);
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, '0', null);
$table->addField($field);
$field = new xmldb_field('completed');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, null, null, '0', null);
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, '0', null);
$table->addField($field);
$field = new xmldb_field('tmp_completed');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, null, null, '0', null);
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, '0', null);
$table->addField($field);
$field = new xmldb_field('value');
$field->set_attributes(XMLDB_TYPE_TEXT, null, null, null, false, null, null, '', null);
$field->set_attributes(XMLDB_TYPE_TEXT, null, null, null, false, '', null);
$table->addField($field);
$key = new xmldb_key('PRIMARY');
@ -106,25 +106,25 @@ function xmldb_feedback_upgrade($oldversion) {
/// Define field random_response to be added to feedback_completed
$table = new xmldb_table('feedback_completed');
$field = new xmldb_field('random_response', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, null, null, '0', null);
$field = new xmldb_field('random_response', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, '0', null);
/// Launch add field1
$dbman->add_field($table, $field);
/// Define field anonymous_response to be added to feedback_completed
$table = new xmldb_table('feedback_completed');
$field = new xmldb_field('anonymous_response', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, null, null, '1', null);
$field = new xmldb_field('anonymous_response', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, '1', null);
/// Launch add field2
$dbman->add_field($table, $field);
/// Define field random_response to be added to feedback_completed
$table = new xmldb_table('feedback_completedtmp');
$field = new xmldb_field('random_response', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, null, null, '0', null);
$field = new xmldb_field('random_response', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, '0', null);
/// Launch add field1
$dbman->add_field($table, $field);
/// Define field anonymous_response to be added to feedback_completed
$table = new xmldb_table('feedback_completedtmp');
$field = new xmldb_field('anonymous_response', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, null, null, '1', null);
$field = new xmldb_field('anonymous_response', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, '1', null);
/// Launch add field2
$dbman->add_field($table, $field);
@ -136,7 +136,7 @@ function xmldb_feedback_upgrade($oldversion) {
// public is a reserved word on Oracle
$table = new xmldb_table('feedback_template');
$field = new xmldb_field('ispublic', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, null, null, '1', null);
$field = new xmldb_field('ispublic', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, false, '1', null);
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
@ -208,7 +208,7 @@ function xmldb_feedback_upgrade($oldversion) {
if ($result && $oldversion < 2008042900) {
/// Define field autonumbering to be added to feedback
$table = new xmldb_table('feedback');
$field = new xmldb_field('autonumbering', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '1', 'multiple_submit');
$field = new xmldb_field('autonumbering', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '1', 'multiple_submit');
/// Launch add field2
$dbman->add_field($table, $field);
@ -218,7 +218,7 @@ function xmldb_feedback_upgrade($oldversion) {
if ($result && $oldversion < 2008050104) {
/// Define field site_after_submit to be added to feedback
$table = new xmldb_table('feedback');
$field = new xmldb_field('site_after_submit', XMLDB_TYPE_CHAR, '255', null, null, false, null, null, '', 'autonumbering');
$field = new xmldb_field('site_after_submit', XMLDB_TYPE_CHAR, '255', null, null, false, '', 'autonumbering');
/// Launch add field2
$dbman->add_field($table, $field);
@ -244,7 +244,7 @@ function xmldb_feedback_upgrade($oldversion) {
if ($result && $oldversion < 2009031301) {
/// Define field label to be added to feedback_item
$table = new xmldb_table('feedback_item');
$field = new xmldb_field('label', XMLDB_TYPE_CHAR, '255', null, null, false, null, null, '', 'name');
$field = new xmldb_field('label', XMLDB_TYPE_CHAR, '255', null, null, false, '', 'name');
/// Launch add field2
$dbman->add_field($table, $field);
@ -255,7 +255,7 @@ function xmldb_feedback_upgrade($oldversion) {
/// Rename field summary on table feedback to intro
$table = new xmldb_table('feedback');
$field = new xmldb_field('summary', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null, 'name');
$field = new xmldb_field('summary', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'name');
/// Launch rename field summary
$dbman->rename_field($table, $field, 'intro');
@ -268,7 +268,7 @@ function xmldb_feedback_upgrade($oldversion) {
/// Define field introformat to be added to feedback
$table = new xmldb_table('feedback');
$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);

View file

@ -67,7 +67,7 @@ function xmldb_forum_upgrade($oldversion) {
/// Define field completiondiscussions to be added to forum
$table = new xmldb_table('forum');
$field = new xmldb_field('completiondiscussions');
$field->set_attributes(XMLDB_TYPE_INTEGER, '9', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'blockperiod');
$field->set_attributes(XMLDB_TYPE_INTEGER, '9', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'blockperiod');
/// Launch add field completiondiscussions
if(!$dbman->field_exists($table,$field)) {
@ -75,7 +75,7 @@ function xmldb_forum_upgrade($oldversion) {
}
$field = new xmldb_field('completionreplies');
$field->set_attributes(XMLDB_TYPE_INTEGER, '9', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'completiondiscussions');
$field->set_attributes(XMLDB_TYPE_INTEGER, '9', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'completiondiscussions');
/// Launch add field completionreplies
if(!$dbman->field_exists($table,$field)) {
@ -84,7 +84,7 @@ function xmldb_forum_upgrade($oldversion) {
/// Define field completionposts to be added to forum
$field = new xmldb_field('completionposts');
$field->set_attributes(XMLDB_TYPE_INTEGER, '9', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'completionreplies');
$field->set_attributes(XMLDB_TYPE_INTEGER, '9', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'completionreplies');
/// Launch add field completionposts
if(!$dbman->field_exists($table,$field)) {
@ -165,7 +165,7 @@ function xmldb_forum_upgrade($oldversion) {
/// Define field maxattachments to be added to forum
$table = new xmldb_table('forum');
$field = new xmldb_field('maxattachments', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '1', 'maxbytes');
$field = new xmldb_field('maxattachments', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '1', 'maxbytes');
/// Conditionally launch add field maxattachments
if (!$dbman->field_exists($table, $field)) {
@ -180,7 +180,7 @@ function xmldb_forum_upgrade($oldversion) {
/// Rename field format on table forum_posts to messageformat
$table = new xmldb_table('forum_posts');
$field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, null, null, '0', 'message');
$field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'message');
/// Launch rename field format
$dbman->rename_field($table, $field, 'messageformat');
@ -193,7 +193,7 @@ function xmldb_forum_upgrade($oldversion) {
/// Define field messagetrust to be added to forum_posts
$table = new xmldb_table('forum_posts');
$field = new xmldb_field('messagetrust', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'messageformat');
$field = new xmldb_field('messagetrust', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'messageformat');
/// Launch add field messagetrust
$dbman->add_field($table, $field);
@ -224,7 +224,7 @@ function xmldb_forum_upgrade($oldversion) {
/// Define field introformat to be added to forum
$table = new xmldb_table('forum');
$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);
@ -246,10 +246,10 @@ function xmldb_forum_upgrade($oldversion) {
/// Changing list of values (enum) of field type on table forum to none
$table = new xmldb_table('forum');
$field = new xmldb_field('type', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null, null, 'general', 'course');
$field = new xmldb_field('type', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, 'general', 'course');
/// Launch change of list of values for field type
$dbman->change_field_enum($table, $field);
$dbman->drop_enum_from_field($table, $field);
/// forum savepoint reached
upgrade_mod_savepoint($result, 2009042700, 'forum');

View file

@ -102,9 +102,9 @@ function xmldb_glossary_upgrade($oldversion) {
if ($result && $oldversion < 2009042000) {
/// Rename field definitionformat on table glossary_entries to NEWNAMEGOESHERE
/// Rename field definitionformat on table glossary_entries to definitionformat
$table = new xmldb_table('glossary_entries');
$field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'definition');
$field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'definition');
/// Launch rename field definitionformat
$dbman->rename_field($table, $field, 'definitionformat');
@ -117,7 +117,7 @@ function xmldb_glossary_upgrade($oldversion) {
/// Define field definitiontrust to be added to glossary_entries
$table = new xmldb_table('glossary_entries');
$field = new xmldb_field('definitiontrust', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'definitionformat');
$field = new xmldb_field('definitiontrust', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'definitionformat');
/// Launch add field definitiontrust
$dbman->add_field($table, $field);
@ -130,7 +130,7 @@ function xmldb_glossary_upgrade($oldversion) {
/// Rename field format on table glossary_comments to NEWNAMEGOESHERE
$table = new xmldb_table('glossary_comments');
$field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'entrycomment');
$field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'entrycomment');
/// Launch rename field format
$dbman->rename_field($table, $field, 'entrycommentformat');
@ -143,7 +143,7 @@ function xmldb_glossary_upgrade($oldversion) {
/// Define field entrycommenttrust to be added to glossary_comments
$table = new xmldb_table('glossary_comments');
$field = new xmldb_field('entrycommenttrust', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'entrycommentformat');
$field = new xmldb_field('entrycommenttrust', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'entrycommentformat');
/// Conditionally launch add field entrycommenttrust
if (!$dbman->field_exists($table, $field)) {
@ -194,7 +194,7 @@ function xmldb_glossary_upgrade($oldversion) {
/// Define field introformat to be added to glossary
$table = new xmldb_table('glossary');
$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');
/// Conditionally launch add field introformat
if (!$dbman->field_exists($table, $field)) {

View file

@ -38,7 +38,7 @@ function xmldb_label_upgrade($oldversion) {
/// Rename field content on table label to intro
$table = new xmldb_table('label');
$field = new xmldb_field('content', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null, 'name');
$field = new xmldb_field('content', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'name');
/// Launch rename field content
$dbman->rename_field($table, $field, 'intro');
@ -51,7 +51,7 @@ function xmldb_label_upgrade($oldversion) {
/// Define field introformat to be added to label
$table = new xmldb_table('label');
$field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, null, null, '4', 'intro');
$field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, '4', 'intro');
/// Launch add field introformat
$dbman->add_field($table, $field);

View file

@ -37,7 +37,7 @@ function xmldb_lesson_upgrade($oldversion) {
/// Rename lesson->usegrademax to lesson->usemaxgrade. Some old sites can have it incorrect. MDL-13177
if ($dbman->field_exists($table, $field) && !$dbman->field_exists($table, $field2)) {
/// Set field specs
$field->set_attributes(XMLDB_TYPE_INTEGER, '3', null, XMLDB_NOTNULL, null, null, null, '0', 'ongoing');
$field->set_attributes(XMLDB_TYPE_INTEGER, '3', null, XMLDB_NOTNULL, null, '0', 'ongoing');
/// Launch rename field usegrademax to usemaxgrade
$dbman->rename_field($table, $field, 'usemaxgrade');
}

View file

@ -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);

View file

@ -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;
}

View file

@ -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)) {

View file

@ -32,7 +32,7 @@ function xmldb_resource_upgrade($oldversion) {
/// Rename field summary on table resource to intro
$table = new xmldb_table('resource');
$field = new xmldb_field('summary', XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'reference');
$field = new xmldb_field('summary', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'reference');
/// Launch rename field summary
$dbman->rename_field($table, $field, 'intro');
@ -45,7 +45,7 @@ function xmldb_resource_upgrade($oldversion) {
/// Define field introformat to be added to resource
$table = new xmldb_table('resource');
$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);

View file

@ -32,7 +32,7 @@ function xmldb_scorm_upgrade($oldversion) {
if ($result && $oldversion < 2008073000) {
$table = new xmldb_table('scorm');
$field = new xmldb_field('whatgrade');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'grademethod');
$field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'grademethod');
/// Launch add field whatgrade
if (!$dbman->field_exists($table,$field)) {
@ -46,7 +46,7 @@ function xmldb_scorm_upgrade($oldversion) {
/// Define field scormtype to be added to scorm
$table = new xmldb_table('scorm');
$field = new xmldb_field('scormtype', XMLDB_TYPE_CHAR, '50', null, XMLDB_NOTNULL, null, null, null, 'local', 'name');
$field = new xmldb_field('scormtype', XMLDB_TYPE_CHAR, '50', null, XMLDB_NOTNULL, null, 'local', 'name');
/// Launch add field scormtype
$dbman->add_field($table, $field);
@ -59,7 +59,7 @@ function xmldb_scorm_upgrade($oldversion) {
/// Define field sha1hash to be added to scorm
$table = new xmldb_table('scorm');
$field = new xmldb_field('sha1hash', XMLDB_TYPE_CHAR, '40', null, null, null, null, null, null, 'updatefreq');
$field = new xmldb_field('sha1hash', XMLDB_TYPE_CHAR, '40', null, null, null, null, 'updatefreq');
/// Launch add field sha1hash
$dbman->add_field($table, $field);
@ -72,7 +72,7 @@ function xmldb_scorm_upgrade($oldversion) {
/// Define field revision to be added to scorm
$table = new xmldb_table('scorm');
$field = new xmldb_field('revision', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'md5hash');
$field = new xmldb_field('revision', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'md5hash');
/// Launch add field revision
$dbman->add_field($table, $field);
@ -236,23 +236,23 @@ function xmldb_scorm_upgrade($oldversion) {
/// Define new fields forcecompleted, forcenewattempt, displayattemptstatus, and displaycoursestructure to be added to scorm
$table = new xmldb_table('scorm');
$field = new xmldb_field('forcecompleted', XMLDB_TYPE_INTEGER, '1', null, null, null, null, null, '0', 'maxattempt');
$field = new xmldb_field('forcecompleted', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'maxattempt');
if (!$dbman->field_exists($table,$field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('forcenewattempt', XMLDB_TYPE_INTEGER, '1', null, null, null, null, null, '0', 'forcecompleted');
$field = new xmldb_field('forcenewattempt', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'forcecompleted');
if (!$dbman->field_exists($table,$field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('lastattemptlock', XMLDB_TYPE_INTEGER, '1', null, null, null, null, null, '0', 'forcenewattempt');
$field = new xmldb_field('lastattemptlock', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'forcenewattempt');
if (!$dbman->field_exists($table,$field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('displayattemptstatus', XMLDB_TYPE_INTEGER, '1', null, null, null, null, null, '1', 'lastattemptlock');
$field = new xmldb_field('displayattemptstatus', XMLDB_TYPE_INTEGER, '1', null, null, null, '1', 'lastattemptlock');
if (!$dbman->field_exists($table,$field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('displaycoursestructure', XMLDB_TYPE_INTEGER, '1', null, null, null, null, null, '1', 'displayattemptstatus');
$field = new xmldb_field('displaycoursestructure', XMLDB_TYPE_INTEGER, '1', null, null, null, '1', 'displayattemptstatus');
if (!$dbman->field_exists($table,$field)) {
$dbman->add_field($table, $field);
}
@ -337,11 +337,11 @@ function xmldb_scorm_upgrade($oldversion) {
if ($result && $oldversion < 2008090308) {
$table = new xmldb_table('scorm');
$field = new xmldb_field('timeopen', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'height');
$field = new xmldb_field('timeopen', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'height');
if (!$dbman->field_exists($table,$field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('timeclose', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'timeopen');
$field = new xmldb_field('timeclose', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'timeopen');
if (!$dbman->field_exists($table,$field)) {
$dbman->add_field($table, $field);
}
@ -404,7 +404,7 @@ function xmldb_scorm_upgrade($oldversion) {
/// Rename field summary on table scorm to intro
$table = new xmldb_table('scorm');
$field = new xmldb_field('summary', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null, 'reference');
$field = new xmldb_field('summary', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'reference');
/// Launch rename field summary
$dbman->rename_field($table, $field, 'intro');
@ -417,7 +417,7 @@ function xmldb_scorm_upgrade($oldversion) {
/// Define field introformat to be added to scorm
$table = new xmldb_table('scorm');
$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);
@ -429,4 +429,4 @@ function xmldb_scorm_upgrade($oldversion) {
return $result;
}
?>
?>

View file

@ -32,7 +32,7 @@ function xmldb_survey_upgrade($oldversion) {
/// Define field introformat to be added to survey
$table = new xmldb_table('survey');
$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');
/// Conditionally launch add field introformat
$dbman->add_field($table, $field);

View file

@ -32,7 +32,7 @@ function xmldb_wiki_upgrade($oldversion) {
/// Rename field summary on table wiki to intro
$table = new xmldb_table('wiki');
$field = new xmldb_field('summary', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null, 'name');
$field = new xmldb_field('summary', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'name');
/// Launch rename field summary
$dbman->rename_field($table, $field, 'intro');
@ -45,7 +45,7 @@ function xmldb_wiki_upgrade($oldversion) {
/// Define field introformat to be added to wiki
$table = new xmldb_table('wiki');
$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);
@ -59,10 +59,10 @@ function xmldb_wiki_upgrade($oldversion) {
/// Changing list of values (enum) of field wtype on table wiki to none
$table = new xmldb_table('wiki');
$field = new xmldb_field('wtype', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null, null, 'group', 'pagename');
$field = new xmldb_field('wtype', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, 'group', 'pagename');
/// Launch change of list of values for field wtype
$dbman->change_field_enum($table, $field);
$dbman->drop_enum_from_field($table, $field);
/// wiki savepoint reached
upgrade_mod_savepoint($result, 2009042700, 'wiki');