You are here

function webform_update_9 in Webform 6.2

Same name and namespace in other branches
  1. 5.2 webform.install \webform_update_9()
  2. 5 webform.install \webform_update_9()

Remove webform version variable, now obsolete with schema and version numbers. Split columns for email_from into email_from_address and email_from_name

File

./webform.install, line 491
Webform module install/schema hooks.

Code

function webform_update_9() {
  variable_del('webform_version');
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'pgsql':
      db_change_column($ret, 'webform', 'email_from', 'email_from_address', 'varchar(255)', array(
        'not null' => FALSE,
        'default' => 'NULL',
      ));
      $ret[] = update_sql('ALTER TABLE {webform} ADD email_from_name varchar(255) NULL DEFAULT NULL');
      break;
    case 'mysqli':
    case 'mysql':
      $ret[] = update_sql('ALTER TABLE {webform} CHANGE email_from email_from_address varchar(255) NULL DEFAULT NULL');
      $ret[] = update_sql('ALTER TABLE {webform} ADD email_from_name varchar(255) NULL DEFAULT NULL AFTER email');
      break;
  }
  return $ret;
}