You are here

filehash.install in File Hash 8

Same filename and directory in other branches
  1. 7 filehash.install

Schema function for file hash module.

File

filehash.install
View source
<?php

/**
 * @file
 * Schema function for file hash module.
 */

/**
 * Implements hook_schema().
 */
function filehash_schema() {
  $schema['filehash'] = [
    'description' => 'Store hashes for each uploaded file.',
    'fields' => [
      'fid' => [
        'description' => 'Primary key: {file_managed}.fid.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'md5' => [
        'description' => 'MD5 hash for this file.',
        'type' => 'varchar_ascii',
        'length' => 32,
        'not null' => FALSE,
      ],
      'sha1' => [
        'description' => 'SHA-1 hash for this file.',
        'type' => 'varchar_ascii',
        'length' => 40,
        'not null' => FALSE,
      ],
      'sha256' => [
        'description' => 'SHA-256 hash for this file.',
        'type' => 'varchar_ascii',
        'length' => 64,
        'not null' => FALSE,
      ],
    ],
    'primary key' => [
      'fid',
    ],
    'indexes' => [
      'md5_idx' => [
        'md5',
      ],
      'sha1_idx' => [
        'sha1',
      ],
      'sha256_idx' => [
        'sha256',
      ],
    ],
    'foreign keys' => [
      'fid' => [
        'table' => 'file_managed',
        'columns' => [
          'fid' => 'fid',
        ],
      ],
    ],
  ];
  return $schema;
}

Functions

Namesort descending Description
filehash_schema Implements hook_schema().