function commerce_file_schema in Commerce File 7.2
Same name and namespace in other branches
- 8.2 commerce_file.install \commerce_file_schema()
- 7 commerce_file.install \commerce_file_schema()
Implements hook_schema().
1 call to commerce_file_schema()
- commerce_file_update_7200 in ./
commerce_file.install - Create the download log table.
File
- ./
commerce_file.install, line 24
Code
function commerce_file_schema() {
// Provides a temporary download log, used for setting download limits.
// Not meant to be user viewable.
$schema['commerce_file_download_log'] = array(
'fields' => array(
'log_id' => array(
'description' => 'The primary key.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'license_id' => array(
'description' => 'The {commerce_license}.license_id of the downloaded file.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'fid' => array(
'description' => 'The {file_managed}.fid of the downloaded file.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'uid' => array(
'description' => 'The {users}.uid of the user that downloaded the file.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'timestamp' => array(
'description' => 'The UNIX timestamp of the date the file was downloaded.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'ip_address' => array(
'description' => 'The IP address of the user that downloaded the file.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'log_id',
),
'indexes' => array(
'license_id' => array(
'license_id',
),
'fid' => array(
'fid',
),
'uid' => array(
'uid',
),
),
'foreign keys' => array(
'licenses' => array(
'table' => 'commerce_license',
'columns' => array(
'license_id' => 'license_id',
),
),
'file_managed' => array(
'table' => 'file_managed',
'columns' => array(
'fid' => 'fid',
),
),
'users' => array(
'table' => 'users',
'columns' => array(
'uid' => 'uid',
),
),
),
);
return $schema;
}