You are here

function anonymous_publishing_update_7001 in Anonymous Publishing 7

Add table {anonymous_publishing_bots}.

File

./anonymous_publishing.install, line 305
Install and uninstall hooks.

Code

function anonymous_publishing_update_7001() {
  $schema['anonymous_publishing_bots'] = array(
    'description' => 'Counts visits by bots based upon IP-address.',
    'fields' => array(
      'id' => array(
        'description' => 'primary index',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'ip' => array(
        'description' => 'IP-address of bot',
        'type' => 'varchar',
        'length' => 16,
        'not null' => TRUE,
        'default' => '',
      ),
      'visits' => array(
        'description' => 'Number of visits',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'first' => array(
        'description' => 'First seen as a Unix timestamp',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'last' => array(
        'description' => 'Last seen as a Unix timestamp',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'unique keys' => array(
      'ip' => array(
        'ip',
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  db_create_table('anonymous_publishing_bots', $schema['anonymous_publishing_bots']);
}