function counter_schema in Counter 8
Same name and namespace in other branches
- 6.2 counter.install \counter_schema()
- 7 counter.install \counter_schema()
Implements hook_schema().
File
- ./
counter.install, line 18 - Install and uninstall functions for the Counter module.
Code
function counter_schema() {
$schema['counter'] = array(
'fields' => array(
'counter_id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'ip' => array(
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'created' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'url' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'uid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'nid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'browser_name' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'browser_version' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'platform' => array(
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
),
'indexes' => array(
'uid' => array(
'uid',
),
'nid' => array(
'nid',
),
'ip' => array(
'ip',
),
'created' => array(
'created',
),
),
'primary key' => array(
'counter_id',
),
);
$schema['counter_data'] = array(
'fields' => array(
'counter_name' => array(
'type' => 'varchar',
'length' => 100,
'not null' => TRUE,
'default' => 0,
),
'counter_value' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'counter_name',
),
);
return $schema;
}