You are here

function webform_update_6301 in Webform 6.3

Add a separate column for confirmation message input format.

File

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

Code

function webform_update_6301() {
  $ret = array();

  // Safety check to prevent re-adding existing column.
  if (db_column_exists('webform', 'confirmation_format')) {
    return $ret;
  }
  db_add_field($ret, 'webform', 'confirmation_format', array(
    'type' => 'int',
    'size' => 'tiny',
    'not null' => TRUE,
    'default' => 0,
  ));
  $result = db_query("SELECT n.nid, nr.format FROM {node} n INNER JOIN {node_revisions} nr ON n.vid = nr.vid WHERE n.type = 'webform'");
  while ($node = db_fetch_object($result)) {
    db_query('UPDATE {webform} SET confirmation_format = %d WHERE nid = %d', $node->format, $node->nid);
  }
  return $ret;
}