function course_update_6134 in Course 6
Give course objects and fulfillments UUIDs.
File
- ./
course.install, line 733 - course.install Install and update functions for Courses.
Code
function course_update_6134() {
$ret = array();
$uuid_field = array(
'type' => 'char',
'length' => 36,
'not null' => TRUE,
'default' => '',
'description' => 'The Universally Unique Identifier.',
);
db_add_field($ret, 'course_outline', 'uuid', $uuid_field);
db_add_field($ret, 'course_outline_fulfillment', 'uuid', $uuid_field);
drupal_install_modules(array(
'uuid',
));
$sql = "SELECT * FROM {course_outline}";
$result = db_query($sql);
while ($row = db_fetch_object($result)) {
db_query("update {course_outline} set uuid = '%s' where snid = %d", uuid_uuid(), $row->snid);
}
$sql = "SELECT * FROM {course_outline_fulfillment}";
$result = db_query($sql);
while ($row = db_fetch_object($result)) {
db_query("update {course_outline_fulfillment} set uuid = '%s' where sfid = %d", uuid_uuid(), $row->sfid);
}
db_add_unique_key($ret, 'course_outline', 'uuid', array(
'uuid',
));
db_add_unique_key($ret, 'course_outline_fulfillment', 'uuid', array(
'uuid',
));
return $ret;
}