You are here

function smileys_update_6000 in Smileys 6

Implementation(s) of hook_update_N().

File

./smileys.install, line 142

Code

function smileys_update_6000() {
  $ret = array();
  if (!db_column_exists('smileys', 'promote_to_box')) {

    // For users who upgraded from Drupal 5 version of smileys, without first upgrading to latest snap for Drupal 5.
    $ret[] = update_sql("ALTER TABLE {smileys} ADD promote_to_box TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' AFTER standalone");
  }

  // Change the default value for "package" column, from "Uncategorized" to "Miscellaneous".
  $ret[] = update_sql("UPDATE {smileys} SET package = 'Miscellaneous' WHERE package = 'Uncategorized'");
  $ret[] = update_sql("ALTER TABLE {smileys} ALTER package SET DEFAULT 'Miscellaneous'");

  // Change package name to reflect changed name.
  $ret[] = update_sql("UPDATE {smileys} SET package = 'Example' WHERE package = 'example'");
  $ret[] = update_sql("UPDATE {smileys} SET image = REPLACE(image, 'example', 'Example')");
  return array_merge($ret);
}