Permalink
Browse files

MDL-37016 fix sloppy mysql nulls in event.uuid

  • Loading branch information...
1 parent a61d4ef commit 709752225c496d2359532f22403c0202a7245f47 @skodak skodak committed Nov 21, 2013
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/db/upgrade.php
View
10 lib/db/upgrade.php
@@ -1293,13 +1293,13 @@ function xmldb_main_upgrade($oldversion) {
}
if ($oldversion < 2012103003.00) {
- // Fix uuid field in event table to match RFC-2445 UID property
+ // Fix uuid field in event table to match RFC-2445 UID property.
$table = new xmldb_table('event');
$field = new xmldb_field('uuid', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'visible');
- if ($dbman->field_exists($table, $field)) {
- // Changing precision of field uuid on table event to (255)
- $dbman->change_field_precision($table, $field);
- }
+ // The column already exists, so make sure there are no nulls (crazy mysql).
+ $DB->set_field_select('event', 'uuid', $DB->sql_empty(), "uuid IS NULL");
+ // Changing precision of field uuid on table event to (255).
+ $dbman->change_field_precision($table, $field);
// Main savepoint reached
upgrade_main_savepoint(true, 2012103003.00);
}

0 comments on commit 7097522

Please sign in to comment.