You are here

function download_count_schema in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/download_count/download_count.install \download_count_schema()
  2. 8.2 modules/custom/download_count/download_count.install \download_count_schema()
  3. 8.3 modules/custom/download_count/download_count.install \download_count_schema()
  4. 8.4 modules/custom/download_count/download_count.install \download_count_schema()
  5. 8.5 modules/custom/download_count/download_count.install \download_count_schema()
  6. 8.6 modules/custom/download_count/download_count.install \download_count_schema()
  7. 8.7 modules/custom/download_count/download_count.install \download_count_schema()
  8. 8.8 modules/custom/download_count/download_count.install \download_count_schema()
  9. 10.3.x modules/custom/download_count/download_count.install \download_count_schema()
  10. 10.0.x modules/custom/download_count/download_count.install \download_count_schema()
  11. 10.1.x modules/custom/download_count/download_count.install \download_count_schema()
  12. 10.2.x modules/custom/download_count/download_count.install \download_count_schema()

Implements hook_schema().

File

modules/custom/download_count/download_count.install, line 13
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',
      ],
    ],
  ];
  return $schema;
}