function user_stats_schema in User Stats 7
Same name and namespace in other branches
- 6 user_stats.install \user_stats_schema()
Implements hook_schema().
File
- ./
user_stats.install, line 11 - Install and update hooks for the User Stats module.
Code
function user_stats_schema() {
$schema['user_stats_values'] = array(
'description' => 'User Stats data.',
'fields' => array(
'name' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
'description' => 'The name of the statistic.',
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {users}.uid of the statistic user.',
),
'value' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The value of the statistic.',
),
),
'primary key' => array(
'name',
'uid',
),
);
$schema['user_stats_ips'] = array(
'description' => 'IP address storage, links timestamps and uids to IP',
'fields' => array(
'iid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary key: IP address unique ID.',
),
'uid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {users}.uid of the user.',
),
'ip_address' => array(
'type' => 'varchar',
'length' => 40,
'not null' => TRUE,
'default' => '',
'description' => "The user's IP address.",
),
'first_seen_timestamp' => array(
'description' => 'The Unix timestamp when the IP address was first used by this user.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'iid',
),
'indexes' => array(
'uid' => array(
'uid',
),
'first_seen_timestamp' => array(
'first_seen_timestamp',
),
),
);
return $schema;
}