You are here

function counter_schema in Counter 6.2

Same name and namespace in other branches
  1. 8 counter.install \counter_schema()
  2. 7 counter.install \counter_schema()

Implementation of hook_schema().

2 calls to counter_schema()
counter_update_6001 in ./counter.install
counter_update_6005 in ./counter.install

File

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

Code

function counter_schema() {
  $schema['counter'] = array(
    'fields' => array(
      'counter_id' => array(
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'counter_ip' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'counter_date' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'counter_page' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
      ),
    ),
    'primary key' => array(
      'counter_id',
    ),
  );
  $schema['counter_today'] = array(
    'fields' => array(
      'counter_id' => array(
        'type' => 'serial',
        'not null' => TRUE,
      ),
      'counter_ip' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'counter_date' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'counter_page' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '0',
      ),
    ),
    'primary key' => array(
      'counter_id',
    ),
  );
  $schema['counter_data'] = array(
    'fields' => array(
      'counter_name' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => 0,
      ),
      'counter_value' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'counter_name',
    ),
  );

  // site_counter, unique_visitor, registered_user, unregistered_user, published_node, unpublished_node
  return $schema;
}