function download_count_schema in Download Count 7.3
Same name and namespace in other branches
- 8 download_count.install \download_count_schema()
- 6.2 download_count.install \download_count_schema()
- 6 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'] = array(
'fields' => array(
'dcid' => array(
'description' => 'Primary Key: Unique download count id.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'fid' => array(
'description' => 'The id from the drupal file_managed table of the file downloaded.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'uid' => array(
'description' => 'The uid of the user that downloaded the file.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'type' => array(
'description' => 'The name of the entity type to which the file was attached when downloaded.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'id' => array(
'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' => array(
'description' => "The IP address of the downloading user.",
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
),
'referrer' => array(
'description' => 'Referrer URI.',
'type' => 'text',
'not null' => TRUE,
),
'timestamp' => array(
'description' => 'The date-time the file was downloaded.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'dcid',
),
'indexes' => array(
'dc_fid' => array(
'fid',
),
'dc_uid' => array(
'uid',
),
'dc_type' => array(
'type',
),
'dc_id' => array(
'id',
),
'dc_ip' => array(
'ip_address',
),
'dc_timestamp' => array(
'timestamp',
),
'dc_fid_type_id' => array(
'fid',
'type',
'id',
),
),
);
$schema['download_count_cache'] = array(
'fields' => array(
'dcc_id' => array(
'description' => 'Primary Key: Unique download count cache id.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'fid' => array(
'description' => t('The id from the drupal files table of the file downloaded.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'type' => array(
'description' => 'The name of the entity type to which the file was attached when downloaded.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'id' => array(
'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' => array(
'description' => t('The date the file was downloaded.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'count' => array(
'description' => t('Number of times a file was downloaded in one day.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'dcc_id',
),
'indexes' => array(
'dcc_fid' => array(
'fid',
),
'dcc_type' => array(
'type',
),
'dcc_id' => array(
'id',
),
'dcc_timestamp' => array(
'date',
),
'dcc_fid_type_id' => array(
'fid',
'type',
'id',
'date',
),
),
);
return $schema;
}