You are here

function i18nstrings_update_6005 in Internationalization 6

Add objectindex, format fields, change objectid to varchar

File

i18nstrings/i18nstrings.install, line 195
Installation file for i18nstrings module.

Code

function i18nstrings_update_6005() {
  $ret = array();
  if (!variable_get('i18nstrings_update_skip', 0)) {
    db_add_field($ret, 'i18n_strings', 'objectindex', array(
      'type' => 'int',
      'not null' => TRUE,
      'default' => 0,
    ));

    // Populate new field from objectid before changing objectid to varchar
    $ret[] = update_sql('UPDATE {i18n_strings} SET objectindex = objectid');
    db_change_field($ret, 'i18n_strings', 'objectid', 'objectid', array(
      'type' => 'varchar',
      'length' => 255,
      'not null' => TRUE,
      'default' => '',
    ));

    // Add format field
    db_add_field($ret, 'i18n_strings', 'format', array(
      'type' => 'int',
      'not null' => TRUE,
      'default' => 0,
    ));

    // Change wrong default value for property (was 'default')
    db_change_field($ret, 'i18n_strings', 'property', 'property', array(
      'type' => 'varchar',
      'length' => 255,
      'not null' => TRUE,
      'default' => '',
    ));
  }
  return $ret;
}