function download_count_schema in Download Count 8
Same name and namespace in other branches
- 6.2 download_count.install \download_count_schema()
- 6 download_count.install \download_count_schema()
- 7.3 download_count.install \download_count_schema()
- 7.2 download_count.install \download_count_schema()
Implements hook_schema().
File
- ./
download_count.install, line 11 - Installation code for the download_count module.
Code
function download_count_schema() {
$schema['download_count'] = [
'fields' => [
'dcid' => [
'description' => 'Primary Key: Unique download count id.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'fid' => [
'description' => 'The {file_managed}.fid of the file downloaded.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'uid' => [
'description' => 'The {user}.uid of user who downloaded the file.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
],
'type' => [
'description' => 'The name of the entity type to which the file was attached when downloaded.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
],
'id' => [
'description' => 'The primary key of the entity to which the file was attached when downloaded.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'ip_address' => [
'description' => 'The IP address of the downloading user.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
],
'referrer' => [
'description' => 'Referrer URI.',
'type' => 'text',
'not null' => TRUE,
],
'timestamp' => [
'description' => 'The date-time the file was downloaded.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
],
'primary key' => [
'dcid',
],
'indexes' => [
'dc_fid' => [
'fid',
],
'dc_uid' => [
'uid',
],
'dc_type' => [
'type',
],
'dc_id' => [
'id',
],
'dc_ip' => [
'ip_address',
],
'dc_timestamp' => [
'timestamp',
],
'dc_fid_type_id' => [
'fid',
'type',
'id',
],
],
];
$schema['download_count_cache'] = [
'fields' => [
'dcc_id' => [
'description' => 'Primary Key: Unique download count cache id.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'fid' => [
'description' => 'The {file_managed}.fid of the file downloaded.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'type' => [
'description' => 'The name of the entity type to which the file was attached when downloaded.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
],
'id' => [
'description' => 'The primary key of the entity to which the file was attached when downloaded.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'date' => [
'description' => 'The date the file was downloaded.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'count' => [
'description' => 'Number of times a file was downloaded in one day.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
],
'primary key' => [
'dcc_id',
],
'indexes' => [
'dcc_fid' => [
'fid',
],
'dcc_type' => [
'type',
],
'dcc_id' => [
'id',
],
'dcc_timestamp' => [
'date',
],
'dcc_fid_type_id' => [
'fid',
'type',
'id',
'date',
],
],
];
return $schema;
}