You are here

function honeypot_update_7003 in Honeypot 7

Add {honeypot_users} database table if it doesn't exist.

File

./honeypot.install, line 119
Install, update and uninstall functions for the Honeypot module.

Code

function honeypot_update_7003() {

  // Make sure the {honeypot_users} table doesn't already exist.
  if (!db_table_exists('honeypot_user')) {
    $table = array(
      'description' => 'Table that stores failed attempts to submit a form.',
      'fields' => array(
        'uid' => array(
          'description' => 'Foreign key to {users}.uid; uniquely identifies a Drupal user to whom this ACL data applies.',
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
        ),
        'timestamp' => array(
          'description' => 'Date/time when the form submission failed, as Unix timestamp.',
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
        ),
      ),
      'indexes' => array(
        'uid' => array(
          'uid',
        ),
        'timestamp' => array(
          'timestamp',
        ),
      ),
    );
    db_create_table('honeypot_user', $table);
  }
}