You are here

function search_by_page_paths_update_6000 in Search by Page 8

Implements hook_update_N().

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

File

search_by_page_paths/search_by_page_paths.install, line 82
Install hooks for search_by_page_paths module

Code

function search_by_page_paths_update_6000() {
  \Drupal::database()
    ->schema()
    ->addField('sbpp_path', 'languages', array(
    'description' => 'Serialized array of languages that can be used for this path',
    'type' => 'text',
  ));
  \Drupal::database()
    ->schema()
    ->addField('sbpp_path', 'environment', array(
    'description' => 'Environment ID',
    'type' => 'int',
    'size' => 'big',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  \Drupal::database()
    ->schema()
    ->addIndex('sbpp_path', 'envi', array(
    'environment',
  ));
  \Drupal::database()
    ->schema()
    ->addField('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,
  ));
  \Drupal::database()
    ->update('sbpp_path')
    ->fields(array(
    'languages' => $val,
    'environment' => 1,
  ))
    ->execute();
}