patient_files


Columns

Column Type Size Nulls Auto Default Children Parents Comments
id uuid 2147483647 gen_random_uuid()
practice_id text 2147483647 null
schema_migrations.id Implied Constraint R
patient_id text 2147483647 null
schema_migrations.id Implied Constraint R
category text 2147483647 null
file_name text 2147483647 null
content_type text 2147483647 √ null
size_bytes int8 19 √ null
storage_provider text 2147483647 's3'::text
object_key text 2147483647 null
upload_status text 2147483647 'pending'::text
completed_at timestamptz 35,6 √ null
created_by_user_id text 2147483647 √ null
schema_migrations.id Implied Constraint R
deleted_at timestamptz 35,6 √ null
deleted_by_user_id text 2147483647 √ null
schema_migrations.id Implied Constraint R
metadata jsonb 2147483647 '{}'::jsonb
created_at timestamptz 35,6 now()
updated_at timestamptz 35,6 now()

Indexes

Constraint Name Type Sort Column(s)
patient_files_pkey Primary key Asc id
patient_files_patient_category_idx Performance Asc/Asc/Asc/Desc practice_id + patient_id + category + created_at
patient_files_patient_uploaded_idx Performance Asc/Asc/Desc practice_id + patient_id + created_at
patient_files_pending_idx Performance Asc created_at
patient_files_storage_object_key_unique Must be unique Asc/Asc storage_provider + object_key

Check Constraints

Constraint Name Constraint
patient_files_file_name_check ((file_name <> ''::text))
patient_files_size_bytes_check (((size_bytes IS NULL) OR (size_bytes >= 0)))
patient_files_category_check ((category = ANY (ARRAY['documents'::text, 'photos'::text, 'media'::text])))
patient_files_upload_status_check ((upload_status = ANY (ARRAY['pending'::text, 'uploaded'::text])))
patient_files_storage_provider_check ((storage_provider = ANY (ARRAY['s3'::text, 'r2'::text])))

Relationships