You are here

function course_update_6127 in Course 6

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

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

File

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

Code

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

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

  // Drop primary key.
  db_drop_primary_key($ret, 'course_report');

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