You are here

function language_hierarchy_update_7100 in Language Hierarchy 7

Change the not-null and default value of the {languages}.parent column.

File

./language_hierarchy.install, line 52

Code

function language_hierarchy_update_7100() {

  // Clean up any invalid (NULL) values.
  db_update('languages')
    ->fields(array(
    'parent' => '',
  ))
    ->condition('parent', NULL)
    ->execute();

  // Clean up the old default of a zero character.
  db_update('languages')
    ->fields(array(
    'parent' => '',
  ))
    ->condition('parent', 0)
    ->execute();
  $spec = array(
    'type' => 'varchar',
    'length' => 12,
    'not null' => TRUE,
    'default' => '',
    'description' => 'Code of parent language.',
  );
  db_change_field('languages', 'parent', 'parent', $spec);
}