Need update from earlier to 6.x-1.9 version

iva2k - November 6, 2009 - 06:57
Project:Contact Forms
Version:6.x-1.9
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
Description

I just downloaded latest 6.x-1.9, and did a quick code inspection. There is a new field 'page_info' that is added to the {contact} table in the contact_forms_install() function. It will work OK for new installation, but for an update from an earlier version, contact_forms_install() function is not called.

To properly update, need a contact_forms_update_N() function, perhaps something like this:

/**
* Implementation of hook_update_N()
*/
function contact_forms_update_6000() {
   //Alter the contact table to add an info field for each category
   $sql = 'ALTER TABLE {contact} ADD page_info TEXT NULL';
  $ret = array();
  $ret[] = update_sql($sql);
  return $ret;
}  

#1

behindthepage - November 8, 2009 - 08:22
Status:active» fixed

Thanks iva2k.

I have added the following code which asheres to the schema rules

function contact_forms_update_6100() {
  $ret = array();
  db_add_field($ret, 'contact', 'page_info', array('type' => 'text', 'not null' => FALSE));
  return $ret;
}

Regards
Geoff

#2

behindthepage - November 9, 2009 - 06:43
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.