Skip to content

Commit

Permalink
Changed drop and add with rename
Browse files Browse the repository at this point in the history
Fixed a problem with md5hash field
  • Loading branch information
bobopinna committed Jan 24, 2007
1 parent 552d35c commit e9c0b9e
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions mod/scorm/db/upgrade.php
Expand Up @@ -223,28 +223,24 @@ function xmldb_scorm_upgrade($oldversion=0) {
$table = new XMLDBTable('scorm'); $table = new XMLDBTable('scorm');
$field = new XMLDBField('external'); $field = new XMLDBField('external');


/// Launch drop field external
$result = $result && drop_field($table, $field);

$field = new XMLDBField('updatefreq');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'maxattempt'); $field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'maxattempt');


/// Launch add field updatefreq /// Launch rename field updatefreq
$result = $result && add_field($table, $field); $result = $result && rename_field($table, $field, 'updatefreq');


/// Rename field md5_result on table scorm to md5hash
$field = new XMLDBField('md5_result'); $field = new XMLDBField('md5_result');

if (field_exists($table, $field)) {
/// Launch drop field md5_result $field->setAttributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, null, 'updatefreq');
$result = $result && drop_field($table, $field);

/// Launch rename field md5hash

$result = $result && rename_field($table, $field, 'md5hash');
/// Define field md5hash to be added to scorm } else {
$field = new XMLDBField('md5hash'); $field = new XMLDBField('md5hash');
$field->setAttributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, null, 'updatefreq'); $field->setAttributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, '', 'updatefreq');


/// Launch add field md5hash $result = $result && add_field($table, $field);
$result = $result && add_field($table, $field); }

} }


return $result; return $result;
Expand Down

0 comments on commit e9c0b9e

Please sign in to comment.