You are here

function course_update_6126 in Course 7.2

Same name and namespace in other branches
  1. 6 course.install \course_update_6126()
  2. 7 course.install \course_update_6126()

Delete old fulfillment duplicates. Add indexes to outline and fulfillment table. Change grade_result to signed.

File

./course.install, line 648
course.install Install and update functions for Courses.

Code

function course_update_6126() {
  $ret = array();

  // This does the same thing as the code it replaced except won't run out of
  // memory. @kludge Does not work with MySQL 5.7+.
  db_query('alter ignore table {course_outline_fulfillment} add unique snid_uid (snid,uid)');
  db_change_field('course_outline_fulfillment', 'grade_result', 'grade_result', array(
    'type' => 'int',
    'not null' => TRUE,
    'unsigned' => FALSE,
    'default' => 0,
    'description' => 'grade_result',
  ));

  // hook_update_N() no longer returns a $ret array. Instead, return
  // nothing or a translated string indicating the update ran successfully.
  // See http://drupal.org/node/224333#update_sql.
  return t('TODO Add a descriptive string here to show in the UI.');
}