You are here

function course_update_6127 in Course 7

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

Change primary key in course_report to `crid` (course report ID).

File

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

Code

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

  // Remove serialness of field.
  db_change_field('course_report', 'id', 'id', array(
    'type' => 'int',
    'not null' => TRUE,
    'unsigned' => TRUE,
  ));

  // Drop primary key.
  db_drop_primary_key('course_report');

  // Rename field, add back serialness.
  db_change_field('course_report', 'id', 'crid', array(
    'type' => 'serial',
    'not null' => TRUE,
    'unsigned' => TRUE,
  ), array(
    'primary key' => array(
      'crid',
    ),
  ));

  // 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.');
}