Understanding `file_usage` table I am trying to understand the Drupal database schema because I need to access the database via MySQL by another system and I do not have access to the original Drupal developer of the site nor do I know Drupal well at this point (I did work with it 8 years ago) and it will be much easier to access with MySQL than to set up a server to have to host a PHP-based API or similar.

file_usage

In the file_usage table there are two (2) field module and type and using a GROUP BY query this is what I get:


module | type
-------|-------
 file  | node
 imce  | file
 user  | user


So it is pretty obvious that module means that entry was added by either the file, imce or user modules, right?

My questions are: 


What does node, file and user mean in this context?  
Is file/node effectively the same as imce/file, or is it
something different? 
Does user/user mean it is a file associated with the user?
Further file_usage has an id column; can I assume:


That nid for file/node and imce/file?
And uid is for user/user? 
Or something else?



NOTE: I do not have access to the working Drupal system, I only have access to the database.
So it is pretty obvious that module means that entry was added by either the file, imce or user modules, right?


Right, it's just the name of the module that added the record.


  What does node, file and user mean in this context?


They're arbitrary strings used by each module to identify the "type" of file usage the current record relates to. A single module might keep to track of files in several different contexts, so this is important.


  Is file/node effectively the same as imce/file, or is it something different?


They're different. file/node is for usage of files attached to a file field on a content type; imce/file is for tracking files uploaded and (potentially) inserted into a WYSIWYG.


  Does user/user mean it is a file associated with the user?


It doesn't have to necessarily, just because it's called user/user, but in this case yes, it does.


  Further file_usage has an id column; can I assume:...


Yes, that assumption is correct. The ID can relate to anything at all though, not just an entity that lives inside Drupal, it's up to the module using the table to be able to resolve which object/item is being referred to from the data in that table.