You are here

function privatemsg_update_6004 in Privatemsg 6.2

Same name and namespace in other branches
  1. 6 privatemsg.install \privatemsg_update_6004()

Create a format column.

Copied from system_update_6051

File

./privatemsg.install, line 495
Install file for privatemsg.module

Code

function privatemsg_update_6004() {
  $ret = array();
  if (!db_column_exists('pm_message', 'format')) {
    $schema = array(
      'type' => 'int',
      'size' => 'small',
      'not null' => TRUE,
      'default' => FILTER_FORMAT_DEFAULT,
      'description' => 'The {filter_formats}.format of the message text.',
    );
    db_add_field($ret, 'pm_message', 'format', $schema);

    // Set the format of existing signatures to the current default input format.
    if ($current_default_filter = (int) variable_get('filter_default_format', 1)) {
      $ret[] = update_sql("UPDATE {pm_message} SET format = " . $current_default_filter);
    }
  }
  return $ret;
}