You are here

function messaging_template_update_6001 in Messaging 6.4

Add primary index and language field

1 call to messaging_template_update_6001()
messaging_update_6012 in ./messaging.install
Fix template_parts table, may be missing new field depending on update path

File

messaging_template/messaging_template.install, line 77

Code

function messaging_template_update_6001() {
  $ret = array();
  db_add_field($ret, 'messaging_message_parts', 'tpid', array(
    'type' => 'serial',
    'unsigned' => TRUE,
    'not null' => TRUE,
  ), array(
    'primary key' => array(
      'tpid',
    ),
  ));
  db_add_field($ret, 'messaging_message_parts', 'language', array(
    'type' => 'varchar',
    'length' => 12,
    'not null' => TRUE,
    'default' => '',
  ), array(
    'indexes' => array(
      'language' => array(
        'language',
      ),
    ),
  ));
  $lang = language_default('language');
  $ret[] = update_sql("UPDATE {messaging_message_parts} SET language = '{$lang}'");
  return $ret;
}