Introduction to the Files Table
The files table is designed to store metadata and references for file uploads associated with processes and companies. This table plays a crucial role in managing and organizing file attachments within the Serial application’s ecosystem.Table Structure
The files table is structured to efficiently store file-related information while maintaining relationships with other key entities in the system. Here’s a detailed breakdown of its columns:| Column Name | Data Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | Unique identifier for each file entry |
| company_id | uuid | foreign key | Reference to the associated company |
| created_at | timestamp with time zone | not null | Timestamp of when the file entry was created |
| dataset_id | uuid | foreign key | Reference to the associated dataset |
| file_id | string | nullable | Identifier for the file in the storage system |
| file_name | string | not null | Name of the uploaded file |
| format | string | not null | Format or extension of the file |
| process_entry_id | uuid | foreign key | Reference to the associated process entry |
| unique_identifier_id | uuid | foreign key | Reference to the associated unique identifier |
| bucket_name | string | not null | Name of the storage bucket (default: ‘data-files’) |
Usage and Functionality
The files table is designed to be a central repository for file metadata within the Serial application. Here are some key points about its usage:- File Association: Each file entry is associated with a specific company, allowing for organized file management across different organizational entities.
- Process Integration: Files can be linked to specific process entries, enabling the attachment of relevant documents or data to particular steps in a workflow.
- Unique Identifier Linking: The table allows files to be connected to unique identifiers, which could represent specific products, batches, or other trackable entities in the system.
- Dataset Correlation: Files can be associated with datasets, potentially allowing for grouping of related files or connecting files to specific data collection efforts.
-
Storage Management: The combination of
file_idandbucket_namecolumns facilitates the management of file storage, potentially across different storage systems or locations.
Notes
-
The structure of the table has evolved over time, with columns being added or renamed to meet changing requirements. For example, the
data_key_idcolumn was renamed todataset_id, indicating a shift in how data is organized or referenced. -
The
file_idbeing nullable suggests that the system might allow for placeholder entries or metadata-only records in some cases. -
Example usage in TypeScript might look like this:

