You are here

function webform_update_6329 in Webform 6.3

Add webform_last_download table to store last downloaded sid per user.

File

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

Code

function webform_update_6329() {

  // Safety check to prevent recreating the webform_last_download table.
  $ret = array();
  if (db_table_exists('webform_last_download')) {
    return $ret;
  }
  $schema['webform_last_download'] = array(
    'description' => 'Stores last submission number per user download.',
    'fields' => array(
      'nid' => array(
        'description' => 'The node identifier of a webform.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'uid' => array(
        'description' => 'The user identifier.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'sid' => array(
        'description' => 'The last downloaded submission number.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'requested' => array(
        'description' => 'Timestamp of last download request.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
      'uid',
    ),
  );
  db_create_table($ret, 'webform_last_download', $schema['webform_last_download']);
  return $ret;
}