# files

View table data

0 rows

### Description

description of files, content is stored in sha1 file pool meaning no duplicate storage https://docs.moodle.org/en/ad-hoc_contributed_reports#List_course_resources_accumulative_file_size_and_count

### Columns

Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments
--- | --- | --- | --- | --- | --- | --- | --- | ---
id | BIGINT | 19 |  | √ | null |
analytics_used_files.fileid | analusedfile_fil2_fkR
file_conversion.destfileid | fileconv_des2_fkR
file_conversion.sourcefileid | fileconv_sou2_fkR
contenthash | VARCHAR | 40 |  |  |  |  |  | sha1 hash of file content
pathnamehash | VARCHAR | 40 |  |  |  |  |  | complete file path sha1 hash - unique for each file
contextid | BIGINT | 19 |  |  | null |  |
context.id | file_con2_fkR
| The context id defined in context table - identifies the instance of plugin owning the file
component | VARCHAR | 100 |  |  |  |  |  | Full name of the component owning the area
filearea | VARCHAR | 50 |  |  |  |  |  | Like "coursefiles". "submission", "intro" and "content" (images and swf linked from summaries), etc.
itemid | BIGINT | 19 |  |  | null |  |  | Optional - some plugin specific item id (eg. forum post, blog entry or assignment submission, user id for user files)
filepath | VARCHAR | 255 |  |  |  |  |  | Optional - relative path to file from module content root, useful in Scorm and Resource mod - most of the mods do not need this
filename | VARCHAR | 255 |  |  |  |  |  | The full Unicode name of this file (case sensitive) - some chars are not allowed though
userid | BIGINT | 19 | √ |  | null |  |
user.id | file_use2_fkR
| Optional - general userid field - meaning depending on plugin
filesize | BIGINT | 19 |  |  | null |  |  |
mimetype | VARCHAR | 100 | √ |  | null |  |  | type of file - jpeg image, open document spreadsheet
status | BIGINT | 19 |  |  | 0 |  |  | number greater than 0 means something is wrong with this file (virus, missing, etc.)
source | LONGTEXT | 2147483647 | √ |  | null |  |  | contains the reference if the file is imported from external sites
author | VARCHAR | 255 | √ |  | null |  |  | The original author of the file
license | VARCHAR | 255 | √ |  | null |  |  | license of the file to guide reuse
timecreated | BIGINT | 19 |  |  | null |  |  |
timemodified | BIGINT | 19 |  |  | null |  |  |
sortorder | BIGINT | 19 |  |  | 0 |  |  | order of files
referencefileid | BIGINT | 19 | √ |  | null |  |
files_reference.id | file_ref2_fkR
| Use to indicate file is a proxy for repository file

### Indexes

Constraint Name | Type | Sort | Column(s)
--- | --- | --- | ---
PRIMARY | Primary key | Asc | id
file_comfilconite_ix | Performance | Asc/Asc/Asc/Asc | component + filearea + contextid + itemid
file_con2_ix | Performance | Asc | contextid
file_con_ix | Performance | Asc | contenthash
file_fil_ix | Performance | Asc | filename
file_lic_ix | Performance | Asc | license
file_pat_uix | Must be unique | Asc | pathnamehash
file_ref_ix | Performance | Asc | referencefileid
file_use_ix | Performance | Asc | userid

### Relationships