Files Table Schema (files)


description of files, content is stored in sha1 file pool

files table columns

Column Type Size Nulls Auto Default Children Parents Comments
id bigint 10 null
file_conversion.destfileid fileconv_des2_fk R
file_conversion.sourcefileid fileconv_sou2_fk R
contenthash varchar 40

sha1 hash of file content

pathnamehash varchar 40

complete file path sha1 hash - unique for each file

contextid bigint 10 null file_con3_fk R

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 10 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 10 null file_use2_fk R

Optional - general userid field - meaning depending on plugin

filesize bigint 10 null
mimetype varchar 100 null

type of file - jpeg image, open document spreadsheet

status bigint 10 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 10 null
timemodified bigint 10 null
sortorder bigint 10 0

order of files

referencefileid bigint 10 null file_ref2_fk R

Use to indicate file is a proxy for repository file

Table contained -1 rows

files table 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_pat_uix Must be unique Asc pathnamehash
file_ref_ix Performance Asc referencefileid
file_use_ix Performance Asc userid

files table relationships