You are here

function sbp_paths_update_6000 in Search by Page 7

Same name and namespace in other branches
  1. 6 sbp_paths.install \sbp_paths_update_6000()

Implements hook_update_N().

Adds languages, environment, and uname fields to sbpp_path table.

File

./sbp_paths.install, line 80
Install hooks for sbp_paths module

Code

function sbp_paths_update_6000() {
  db_add_field('sbpp_path', 'languages', array(
    'description' => 'Serialized array of languages that can be used for this path',
    'type' => 'text',
  ));
  db_add_field('sbpp_path', 'environment', array(
    'description' => 'Environment ID',
    'type' => 'int',
    'size' => 'big',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  db_add_index('sbpp_path', 'envi', array(
    'environment',
  ));
  db_add_field('sbpp_path', 'uname', array(
    'description' => 'User name used to index this path',
    'type' => 'varchar',
    'length' => '60',
  ));

  // Set default for languages and environment
  $lang = language_default('language');
  $val = serialize(array(
    $lang => $lang,
  ));
  db_update('sbpp_path')
    ->fields(array(
    'languages' => $val,
    'environment' => 1,
  ))
    ->execute();
}