You are here

function farm_plan_consideration_update_7000 in farmOS 7

Rename columns in plan consideration table to avoid reserved SQL words.

File

modules/farm/farm_plan/farm_plan_consideration/farm_plan_consideration.install, line 94
Farm plan consideration install.

Code

function farm_plan_consideration_update_7000(&$sandbox) {

  // Drop old indexes.
  db_drop_index('farm_plan_consideration', 'start');
  db_drop_index('farm_plan_consideration', 'end');

  // Change start to start_time.
  $start_time = array(
    'description' => 'The timestamp when this consideration starts.',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
  );
  $start_time_keys = array(
    'indexes' => array(
      'start_time' => array(
        'start_time',
      ),
    ),
  );
  db_change_field('farm_plan_consideration', 'start', 'start_time', $start_time, $start_time_keys);

  // Change end to end_time.
  $end_time = array(
    'description' => 'The timestamp when this consideration ends.',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
  );
  $end_time_keys = array(
    'indexes' => array(
      'end_time' => array(
        'end_time',
      ),
    ),
  );
  db_change_field('farm_plan_consideration', 'end', 'end_time', $end_time, $end_time_keys);
}