Columns
| Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| stored_file_id | uuid | 2147483647 | null |
|
|
||||||||||||||||||||||||
| company_id | uuid | 2147483647 | null |
|
|
||||||||||||||||||||||||
| name | varchar | 255 | null |
|
|
||||||||||||||||||||||||
| mime_type | varchar | 127 | null |
|
|
||||||||||||||||||||||||
| size | int8 | 19 | null |
|
|
||||||||||||||||||||||||
| purpose | varchar | 60 | null |
|
|
||||||||||||||||||||||||
| task_id | uuid | 2147483647 | √ | null |
|
|
|||||||||||||||||||||||
| worker_id | uuid | 2147483647 | √ | null |
|
|
|||||||||||||||||||||||
| storage_key | varchar | 255 | null |
|
|
||||||||||||||||||||||||
| scan_status | varchar | 20 | null |
|
|
||||||||||||||||||||||||
| verified | bool | 1 | false |
|
|
||||||||||||||||||||||||
| created_at | timestamptz | 35,6 | CURRENT_TIMESTAMP |
|
|
||||||||||||||||||||||||
| checksum_sha256 | varchar | 64 | √ | null |
|
|
|||||||||||||||||||||||
| updated_at | timestamptz | 35,6 | CURRENT_TIMESTAMP |
|
|
Indexes
| Constraint Name | Type | Sort | Column(s) |
|---|---|---|---|
| pk_stored_file | Primary key | Asc | stored_file_id |
| idx_stored_file_company | Performance | Asc | company_id |
| idx_stored_file_company_task | Performance | Asc/Asc | company_id + task_id |
| idx_stored_file_company_worker | Performance | Asc/Asc | company_id + worker_id |
| uq_stored_file_id_company | Must be unique | Asc/Asc | stored_file_id + company_id |
| uq_stored_file_storage_key | Must be unique | Asc | storage_key |
Check Constraints
| Constraint Name | Constraint |
|---|---|
| ck_stored_file_name_not_blank | ((char_length(TRIM(BOTH FROM name)) > 0)) |
| ck_stored_file_size_positive | ((size > 0)) |
| ck_stored_file_purpose_not_blank | ((char_length(TRIM(BOTH FROM purpose)) > 0)) |
| ck_stored_file_mime_type_not_blank | ((char_length(TRIM(BOTH FROM mime_type)) > 0)) |
| ck_stored_file_checksum_sha256 | (((checksum_sha256 IS NULL) OR ((char_length((checksum_sha256)::text) = 64) AND ((checksum_sha256)::text = lower((checksum_sha256)::text))))) |
| ck_stored_file_scan_status | (((scan_status)::text = 'NOT_SCANNED'::text)) |



