1 language.install language_update_1000()

Rename {language}.language to {language}.langcode.

See also

update_prepare_language()

Related topics

File

core/modules/language/language.install, line 89
Install, update and uninstall functions for the language module.

Code

function language_update_1000() {
  // Rename language column to langcode and set it again as the primary key.
  if (db_field_exists('language', 'language')) {
    db_drop_primary_key('language');
    $langcode_spec = array(
      'type' => 'varchar',
      'length' => 12,
      'not null' => TRUE,
      'default' => '',
      'description' => "Language code, e.g. 'de' or 'en-US'.",
    );
    db_change_field('language', 'language', 'langcode', $langcode_spec, array('primary key' => array('langcode')));
  }

  // Update the 'language_default' system variable, if configured.
  $language_default = update_variable_get('language_default');
  if (!empty($language_default) && isset($language_default->language)) {
    $language_default->langcode = $language_default->language;
    unset($language_default->language);
    update_variable_set('language_default', $language_default);
  }
}