stored_file

-1 rows


Columns

Column Type Size Nulls Auto Default Children Parents Comments
stored_file_id uuid 2147483647 null
document_ocr_run.stored_file_id fk_document_ocr_run_file_company R
worker_document_upload_idempotency.stored_file_id fk_worker_document_upload_idempotency_file_company R
worker_import_job.source_file_id fk_worker_import_job_source_file_company R
worker_response_upload.stored_file_id fk_worker_response_upload_file_company R
company_id uuid 2147483647 null
document_ocr_run.company_id fk_document_ocr_run_file_company R
worker_document_upload_idempotency.company_id fk_worker_document_upload_idempotency_file_company R
worker_import_job.company_id fk_worker_import_job_source_file_company R
worker_response_upload.company_id fk_worker_response_upload_file_company R
company.company_id fk_stored_file_company R
worker.company_id fk_stored_file_worker_company R
task.company_id fk_stored_file_task_company R
name varchar 255 null
mime_type varchar 127 null
size int8 19 null
purpose varchar 60 null
task_id uuid 2147483647 null
task.task_id fk_stored_file_task_company R
worker_id uuid 2147483647 null
worker.worker_id fk_stored_file_worker_company R
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))

Relationships