You are here

function counter_update_7104 in Counter 7

Add fields: nid, type, browser name, browser version, platform

1 call to counter_update_7104()
counter_install in ./counter.install
Implements hook_install().

File

./counter.install, line 206
Install the module with a new database table

Code

function counter_update_7104() {
  if (!db_field_exists('counter', 'nid')) {
    db_add_field('counter', 'nid', array(
      'type' => 'int',
      'not null' => TRUE,
      'default' => 0,
    ));
    db_add_index('counter', 'nid', array(
      'nid',
    ));
  }
  if (!db_field_exists('counter', 'type')) {
    db_add_field('counter', 'type', array(
      'type' => 'varchar',
      'length' => 256,
      'not null' => TRUE,
      'default' => '',
    ));
  }
  if (!db_field_exists('counter', 'browser_name')) {
    db_add_field('counter', 'browser_name', array(
      'type' => 'varchar',
      'length' => 64,
      'not null' => TRUE,
      'default' => '',
    ));
  }
  if (!db_field_exists('counter', 'browser_version')) {
    db_add_field('counter', 'browser_version', array(
      'type' => 'varchar',
      'length' => 64,
      'not null' => TRUE,
      'default' => '',
    ));
  }
  if (!db_field_exists('counter', 'platform')) {
    db_add_field('counter', 'platform', array(
      'type' => 'varchar',
      'length' => 64,
      'not null' => TRUE,
      'default' => '',
    ));
  }
}