function course_update_7144 in Course 7.2
Update empty "updated" dates.
File
- ./
course.install, line 1279 - course.install Install and update functions for Courses.
Code
function course_update_7144() {
db_add_field('course_enrollment', 'updated', array(
'type' => 'int',
'not null' => FALSE,
'unsigned' => TRUE,
'default' => NULL,
'description' => 'Date this record was updated.',
));
db_query('UPDATE {course_enrollment} SET updated = created');
db_query('UPDATE {course_report} cr INNER JOIN {course_enrollment} ce ON (ce.uid = cr.uid AND ce.nid = cr.nid) SET cr.updated = COALESCE(cr.date_completed, ce.timestamp, ce.created) WHERE cr.updated IS NULL');
}