filehash.install in File Hash 8
Same filename and directory in other branches
Schema function for file hash module.
File
filehash.installView 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
Name | Description |
---|---|
filehash_schema | Implements hook_schema(). |